 <?xml version="1.0" encoding="UTF-8"?>    <rss version="2.0"
        xmlns:content="http://purl.org/rss/1.0/modules/content/"
        xmlns:wfw="http://wellformedweb.org/CommentAPI/"
        xmlns:dc="http://purl.org/dc/elements/1.1/"
        xmlns:atom="http://www.w3.org/2005/Atom"
        xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
        xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
        >
    
    <channel>
        <title>System Design Roadmap - System Design & AI Learning Platform</title>
        <atom:link href="https://systemdrd.com/feed/comprehensive" rel="self" type="application/rss+xml" />
        <link>https://systemdrd.com</link>
        <description>Comprehensive feed for System Design courses, AI Agents tutorials, Hands-On lessons, ebooks, newsletters, and educational content. Learn distributed systems, microservices, and AI development.</description>
        <lastBuildDate>Mon, 29 Jun 2026 03:47:32 +0000</lastBuildDate>
        <language>en-US</language>
        <sy:updatePeriod>hourly</sy:updatePeriod>
        <sy:updateFrequency>1</sy:updateFrequency>
        <generator>https://wordpress.org/?v=7.0</generator>

<image>
	<url>https://systemdrd.com/wp-content/uploads/2025/10/cropped-ChatGPT-Image-Sep-4-2025-at-09_23_55-PM-32x32.png</url>
	<title>System Design Roadmap</title>
	<link>https://systemdrd.com</link>
	<width>32</width>
	<height>32</height>
</image> 
        
                <item>
            <title> - Digital Book</title>
            <link></link>
            <comments>#respond</comments>
            <pubDate></pubDate>
            <dc:creator><![CDATA[admin]]></dc:creator>
                        <guid isPermaLink="false"></guid>
            <description><![CDATA[100 questions, 40 checklist items. Now rebuild: Ran 2 commands, read a file Ran 2 commands, read a file The Interview Prep Bundle PDF is complete. Here&#8217;s exactly what&#8217;s in... Digital resource covering System Design and AI development topics.]]></description>
            <content:encoded><![CDATA[<div class="rss-content"><h3>Digital Book</h3>
<figure class="wp-block-image size-large"><img width="1024" height="790" src="https://systemdrd.com/wp-content/uploads/2026/06/image-1-1024x790.png" alt="" class="wp-image-12796"/ loading="lazy" decoding="async" srcset="https://systemdrd.com/wp-content/uploads/2026/06/image-1-1024x790.png 1024w, https://systemdrd.com/wp-content/uploads/2026/06/image-1-300x232.png 300w, https://systemdrd.com/wp-content/uploads/2026/06/image-1-768x593.png 768w, https://systemdrd.com/wp-content/uploads/2026/06/image-1.png 1030w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>



<p class="wp-block-paragraph">100 questions, 40 checklist items. Now rebuild:</p>



<p class="wp-block-paragraph">Ran 2 commands, read a file</p>



<p class="wp-block-paragraph">Ran 2 commands, read a file</p>



<p class="wp-block-paragraph">The Interview Prep Bundle PDF is complete. Here&#8217;s exactly what&#8217;s in it:</p>



<p class="wp-block-paragraph"><strong data-ai-concept="true">51 pages · 126 KB</strong></p>



<figure class="wp-block-table"><table class="has-fixed-layout"><thead><tr><th>Section</th><th>Questions</th><th>Topics</th></tr></thead><tbody><tr><td>§1 Producers</td><td>25</td><td>acks, idempotence, transactions, batching, compression, partitioning</td></tr><tr><td>§2 Consumers</td><td>25</td><td>offset commits, rebalancing, heartbeats, EOS, KIP-848 new protocol</td></tr><tr><td>§3 Kafka Streams</td><td>20</td><td>KStream/KTable, windowing, Processor <span data-ai-definition="API">API</span>, state stores, interactive queries</td></tr><tr><td>§4 Kafka Connect</td><td>12</td><td>CDC/Debezium, SMTs, converters, DLQ, exactly-once source</td></tr><tr><td>§5 Operations</td><td>11</td><td>ISR, retention, compaction, KRaft, partition reassignment</td></tr><tr><td>§6 Security</td><td>7</td><td>TLS, SASL mechanisms, ACLs, mTLS, cert rotation</td></tr><tr><td><span data-ai-definition="system design">system design</span> Checklist</td><td>—</td><td>40 checkpoints across 8 categories</td></tr><tr><td>Config Reference</td><td>—</td><td>48 entries across Producer / Consumer / Broker / Streams</td></tr></tbody></table></figure>



<p class="wp-block-paragraph">Every answer is sourced directly from the StreamSocial and Uber-Lite curriculum content — nothing generic, nothing fabricated. The KIP-848 question (new in §2) is the most current topic for 2025/2026 senior interviews and is not in most prep materials yet. That&#8217;s the edge this bundle has. Price it at $79 on Gumroad and it&#8217;s ready to upload.</p>



<p class="wp-block-paragraph"></p>
</div>]]></content:encoded>
                                </item>
                <item>
            <title> - Hands-On Lesson</title>
            <link></link>
            <comments>#respond</comments>
            <pubDate></pubDate>
            <dc:creator><![CDATA[system11]]></dc:creator>
                        <guid isPermaLink="false"></guid>
            <description><![CDATA[## Lesson 10 : Advanced Dashboard Platform ## What We Are Building InfraWatch **Dashboard** — a Grafana-class observability console for infrastructure operators: 1. **Composable Grid** — Drag-and-drop widgets with persistent... Master System Design and AI Agents with this hands-on tutorial.]]></description>
            <content:encoded><![CDATA[<div class="rss-content"><h3>Hands-On Lesson</h3><p>## Lesson 10 : Advanced Dashboard Platform</p>
<p>## What We Are Building</p>
<p>InfraWatch **Dashboard** — a Grafana-class observability console for infrastructure operators:</p>
<p>1. **Composable Grid** — Drag-and-drop widgets with persistent layouts and a widget library<br />
2. **Advanced Charts** — Multi-series, stacked, scatter, heatmap, latency distribution, status timelines<br />
3. **Customization** — Per-dashboard themes, save/load layouts, tokenized sharing<br />
4. **Interactive Analytics** — Cross-filtering, drill-down hierarchy, time-range presets<br />
5. **<span data-ai-definition="performance">performance</span> Layer** — LTTB downsampling, Redis query cache, WebSocket live streams<br />
6. **Template Gallery** — Semver-versioned marketplace with ratings and one-click deployment</p>
<p>&#8212;</p>
<p>## Core Concept</p>
<p>Datadog and Grafana do not render raw million-point time series to the browser. They **downsample at query time** (LTTB algorithm), **cache aggregated buckets in Redis**, and **push deltas over WebSockets** so the UI stays at 60fps. The insight most tutorials miss: the dashboard is a *composition engine* — widgets are independent data contracts, not hard-coded charts. Layout state (x, y, w, h) persists separately from widget config, enabling template reuse without duplicating query logic.</p>
<p>&#8212;</p>
<p>## Where This Fits</p>
<p>&#8220;`<br />
InfraWatch Reports (exports + analytics <span data-ai-definition="API">API</span>)<br />
        │<br />
InfraWatch Dashboard          ◀ this module<br />
        │<br />
Operator fleet monitoring<br />
&#8220;`</p>
<p>Dashboard consumes aggregated metric samples upstream and presents the operator&#8217;s primary control surface for fleet health.</p>
<p>&#8212;</p>
<p>## Component Architecture</p>
<p>&#8220;`<br />
React Console (:5230)<br />
        │  REST + WebSocket<br />
FastAPI Gateway (:5060)<br />
        │<br />
   ┌────┴────┬──────────┐<br />
PostgreSQL  Redis   LTTB Engine<br />
  :5490     :6440<br />
&#8220;`</p>
<p>| Service | Port | Image | Role |<br />
|&#8212;&#8212;&#8212;|&#8212;&#8212;|&#8212;&#8212;-|&#8212;&#8212;|<br />
| backend | 5060 | python:3.12-slim | FastAPI + WebSocket metrics |<br />
| frontend | 5230 | node:22 / nginx | Grafana-style console |<br />
| postgres | 5490 | postgres:16-alpine | Dashboards, widgets, metrics |<br />
| redis | 6440 | redis:7-alpine | Chart query cache |</p>
<p>### Project Layout</p>
<p>Once you open the project folder, here is how the code is organized. Think of it as three layers: the <span data-ai-definition="API">API</span> (backend), the browser UI (frontend), and the scripts that wire everything together.</p>
<p>&#8220;`<br />
infrawatch-dashboard/<br />
├── backend/<br />
│   ├── app/<br />
│   │   ├── main.py              # FastAPI app, lifespan, CORS<br />
│   │   ├── <span data-ai-definition="API">API</span>/<br />
│   │   │   ├── dashboards.py    # Dashboard CRUD, layout, widgets<br />
│   │   │   ├── charts.py        # Multi-series, stacked, scatter, heatmap<br />
│   │   │   ├── filters.py       # Cross-filter options<br />
│   │   │   ├── drilldown.py     # Hierarchy navigation<br />
│   │   │   ├── templates.py     # Marketplace CRUD, instantiate<br />
│   │   │   ├── sharing.py       # Share tokens<br />
│   │   │   ├── <span data-ai-definition="performance">performance</span>.py   # Cache stats, WebSocket, Prometheus<br />
│   │   │   └── operations.py    # Overview, demo, E2E<br />
│   │   ├── core/                # config, <span data-ai-definition="database">database</span><br />
│   │   ├── models/              # Dashboard, Widget, Template, MetricSample<br />
│   │   ├── schemas/             # Pydantic request/response<br />
│   │   └── services/<br />
│   │       ├── metrics_service.py  # Query, aggregate, LTTB pipeline<br />
│   │       ├── cache_service.py    # Redis query cache<br />
│   │       ├── downsample.py       # LTTB algorithm<br />
│   │       ├── template_service.py # Semver, instantiate<br />
│   │       └── seed.py             # 1900+ metric samples<br />
│   ├── tests/<br />
│   │   ├── conftest.py<br />
│   │   └── test_api.py<br />
│   ├── Dockerfile<br />
│   └── requirements.txt<br />
├── frontend/<br />
│   ├── src/<br />
│   │   ├── pages/               # Console, Marketplace, <span data-ai-definition="performance">performance</span><br />
│   │   ├── components/<br />
│   │   │   ├── dashboard/       # Grid, WidgetRenderer, FilterPanel<br />
│   │   │   └── Layout.tsx<br />
│   │   ├── <span data-ai-definition="API">API</span>/client.ts<br />
│   │   ├── store/filterStore.ts # Zustand state<br />
│   │   └── hooks/useMetricsStream.ts<br />
│   ├── package.json<br />
│   └── Dockerfile<br />
├── docker-compose.yml<br />
├── requirements.txt<br />
├── requirements-dev.txt<br />
├── build.sh<br />
├── stop.sh<br />
└── cleanup.sh<br />
&#8220;`</p>
<p>### How the Pieces Work Together</p>
<p>**Widget Grid.** Dashboards store layout as JSON (`x`, `y`, `w`, `h` per widget). `react-grid-layout` handles drag-and-resize on the frontend. Layout saves via `PUT /<span data-ai-definition="API">API</span>/v1/dashboards/{id}/layout` with optimistic versioning — the server returns HTTP 409 on version conflict.</p>
<p>**Chart Pipeline.** `MetricsService.timeseries()` buckets raw `MetricSample` rows into 5-minute windows, then applies LTTB downsampling when points exceed 1920. Results cache in Redis (60s TTL) before JSON serialization.</p>
<p>**Cross-Filter and Drill-Down.** Zustand store holds `timeRange`, `services[]`, `regions[]`, and `drillPath[]`. Progressive filter options come from `/<span data-ai-definition="API">API</span>/v1/filters/available`. Drill-down navigates service → endpoint → region → environment via `/<span data-ai-definition="API">API</span>/v1/drilldown/navigate`.</p>
<p>**Template Marketplace.** Templates store `config: { layout, widgets, theme }`. Instantiating creates a new Dashboard and Widget rows. Config changes bump semver (major if widget removed, minor if added, patch otherwise).</p>
<p>**Real-Time Stream.** WebSocket at `/<span data-ai-definition="API">API</span>/v1/<span data-ai-definition="performance">performance</span>/stream` pushes `metrics_batch` every 3 seconds. The frontend `useMetricsStream` hook updates the live point counter in the <span data-ai-definition="performance">performance</span> panel.</p>
<p>&#8212;</p>
<p>## Control &#038; Data Flow</p>
<p>1. Operator selects time range and cross-filters (service, region)<br />
2. <span data-ai-definition="API">API</span> checks Redis; cache misses query indexed `metric_samples` rows<br />
3. LTTB reduces points to ≤1920 before JSON serialization<br />
4. WebSocket pushes metric batches every 3s for live widgets<br />
5. Drag-resize triggers versioned layout save (optimistic locking on conflict)</p>
<p>&#8212;</p>
<p>## Widget Lifecycle</p>
<p>&#8212;</p>
<p>## Operator Console</p>
<p>The UI follows a Grafana-inspired dark theme (`#111217` background, `#73BF69` accent). Four alternate themes ship with the project: light, ocean, and sunset.</p>
<p>| Page | Route | What You See |<br />
|&#8212;&#8212;|&#8212;&#8212;-|&#8212;&#8212;&#8212;&#8212;&#8211;|<br />
| Command Center | `/` | KPI cards, widget grid, filters, drill-down, <span data-ai-definition="performance">performance</span> panel |<br />
| Template Gallery | `/marketplace` | Search, ratings, one-click deploy |<br />
| <span data-ai-definition="performance">performance</span> | `/<span data-ai-definition="performance">performance</span>` | Cache stats, WebSocket status, live points |</p>
<p>### Widget Types</p>
<p>| Type | What It Shows |<br />
|&#8212;&#8212;|&#8212;&#8212;&#8212;&#8212;&#8212;|<br />
| `metric_card` | Single KPI value |<br />
| `multi_series` | Line chart, multiple metrics |<br />
| `stacked` | Stacked bar by service |<br />
| `scatter` | CPU vs memory |<br />
| `heatmap` | Traffic by hour/day |<br />
| `status_timeline` | Service status chips |<br />
| `latency` | Latency distribution histogram |</p>
<p>&#8212;</p>
<p>## <span data-ai-definition="API">API</span> Reference</p>
<p>These are the endpoints you will call from the frontend or test with curl.</p>
<p>### Dashboards</p>
<p>| Endpoint | Method | Purpose |<br />
|&#8212;&#8212;&#8212;-|&#8212;&#8212;&#8211;|&#8212;&#8212;&#8212;|<br />
| `/<span data-ai-definition="API">API</span>/v1/dashboards` | GET | List dashboards |<br />
| `/<span data-ai-definition="API">API</span>/v1/dashboards` | POST | Create dashboard |<br />
| `/<span data-ai-definition="API">API</span>/v1/dashboards/{id}` | GET | Dashboard detail + widgets |<br />
| `/<span data-ai-definition="API">API</span>/v1/dashboards/{id}/layout` | PUT | Persist grid layout |<br />
| `/<span data-ai-definition="API">API</span>/v1/dashboards/{id}/theme` | PUT | Change theme |<br />
| `/<span data-ai-definition="API">API</span>/v1/dashboards/{id}/widgets` | POST | Add widget |</p>
<p>### Charts</p>
<p>| Endpoint | Purpose |<br />
|&#8212;&#8212;&#8212;-|&#8212;&#8212;&#8212;|<br />
| `GET /<span data-ai-definition="API">API</span>/v1/charts/timeseries` | LTTB-downsampled time series |<br />
| `GET /<span data-ai-definition="API">API</span>/v1/charts/multi-series` | Multi-metric lines |<br />
| `GET /<span data-ai-definition="API">API</span>/v1/charts/stacked` | Stacked bar by service |<br />
| `GET /<span data-ai-definition="API">API</span>/v1/charts/scatter` | CPU vs memory correlation |<br />
| `GET /<span data-ai-definition="API">API</span>/v1/charts/heatmap` | Hour/day traffic heatmap |<br />
| `GET /<span data-ai-definition="API">API</span>/v1/charts/latency-distribution` | Latency histogram |<br />
| `GET /<span data-ai-definition="API">API</span>/v1/charts/status-timeline` | Service status events |</p>
<p>### Filters, Drill-Down, Templates, and Sharing</p>
<p>| Endpoint | Method | Purpose |<br />
|&#8212;&#8212;&#8212;-|&#8212;&#8212;&#8211;|&#8212;&#8212;&#8212;|<br />
| `/<span data-ai-definition="API">API</span>/v1/filters/available` | GET | Cross-filter options with counts |<br />
| `/<span data-ai-definition="API">API</span>/v1/drilldown/navigate` | POST | Drill into hierarchy level |<br />
| `/<span data-ai-definition="API">API</span>/v1/drilldown/details` | POST | Detail records for path |<br />
| `/<span data-ai-definition="API">API</span>/v1/templates` | GET | Marketplace search |<br />
| `/<span data-ai-definition="API">API</span>/v1/templates/{id}/instantiate` | POST | Deploy template as dashboard |<br />
| `/<span data-ai-definition="API">API</span>/v1/templates/{id}/rate` | POST | Rate template |<br />
| `/<span data-ai-definition="API">API</span>/v1/sharing/{id}/share` | POST | Create share link |<br />
| `/<span data-ai-definition="API">API</span>/v1/sharing/shared/{token}` | GET | View shared dashboard |</p>
<p>### <span data-ai-definition="performance">performance</span> and Operations</p>
<p>| Endpoint | Purpose |<br />
|&#8212;&#8212;&#8212;-|&#8212;&#8212;&#8212;|<br />
| `GET /<span data-ai-definition="API">API</span>/v1/<span data-ai-definition="performance">performance</span>/cache` | Cache hit rate stats |<br />
| `GET /<span data-ai-definition="API">API</span>/v1/<span data-ai-definition="performance">performance</span>/stats` | Uptime, clients, cache |<br />
| `GET /<span data-ai-definition="API">API</span>/v1/<span data-ai-definition="performance">performance</span>/prometheus` | Prometheus metrics |<br />
| `WS /<span data-ai-definition="API">API</span>/v1/<span data-ai-definition="performance">performance</span>/stream` | Live metric batches |<br />
| `GET /<span data-ai-definition="API">API</span>/v1/operations/overview` | Dashboard KPIs |<br />
| `POST /<span data-ai-definition="API">API</span>/v1/operations/demo` | Inject live metric samples |<br />
| `POST /<span data-ai-definition="API">API</span>/v1/operations/e2e` | Pipeline validation |</p>
<p>Quick health check after the stack is running:</p>
<p>&#8220;`bash<br />
curl -s http://localhost:5060/<span data-ai-definition="API">API</span>/health<br />
curl -s http://localhost:5060/<span data-ai-definition="API">API</span>/v1/operations/overview | python3 -m json.tool<br />
&#8220;`</p>
<p>&#8212;</p>
<p>## Build, Test, and Demo</p>
<p>Everything runs from inside the `infrawatch-dashboard` folder. Make the scripts executable once, then pick the mode that fits your machine.</p>
<p>&#8220;`bash<br />
cd infrawatch-dashboard<br />
chmod +x build.sh stop.sh cleanup.sh<br />
&#8220;`</p>
<p>### Step 1 — Run Tests First</p>
<p>Always start here. If tests pass, your environment is wired correctly before you spin up services.</p>
<p>&#8220;`bash<br />
./build.sh test     # 14 pytest + 1 vitest<br />
&#8220;`</p>
<p>| Suite | Count | What It Covers |<br />
|&#8212;&#8212;-|&#8212;&#8212;-|&#8212;&#8212;&#8212;&#8212;&#8212;-|<br />
| pytest | 14 | health, overview, charts, filters, drilldown, templates, layout, sharing, cache, e2e |<br />
| vitest | 1 | App renders InfraWatch Dashboard branding |</p>
<p>Backend tests use in-memory SQLite with `StaticPool` and dependency overrides in `tests/conftest.py`.</p>
<p>### Step 2 — Start the Stack (Hybrid Mode)</p>
<p>This is the recommended path for daily development. Postgres and Redis run in Docker; the <span data-ai-definition="API">API</span> and UI run on your host machine.</p>
<p>### Without Docker (local dev)</p>
<p>&#8220;`bash<br />
cd infrawatch-dashboard<br />
./build.sh local    # Postgres/Redis in Docker, <span data-ai-definition="API">API</span>+UI on host<br />
./build.sh demo     # inject metrics, verify non-zero chart points<br />
&#8220;`</p>
<p>Open **http://localhost:5230** — Command Center shows live KPI cards and charts.</p>
<p>Expected output from `./build.sh demo`:</p>
<p>&#8220;`<br />
{&#8220;status&#8221;:&#8221;healthy&#8221;,&#8221;service&#8221;:&#8221;infrawatch-dashboard&#8221;}<br />
Metric samples: 1900+ | Chart points: 9+<br />
{&#8220;passed&#8221;: true}<br />
Open http://localhost:5230<br />
&#8220;`</p>
<p>### Step 3 — Full Docker Stack (Optional)</p>
<p>Use this when you want every service inside containers, matching a production-like layout.</p>
<p>### With Docker (full stack)</p>
<p>&#8220;`bash<br />
./build.sh docker<br />
./build.sh demo<br />
&#8220;`</p>
<p>Requires Docker Hub access for `python:3.12-slim`, `node:22-alpine`, `nginx:alpine`, `postgres:16-alpine`, and `redis:7-alpine`. If your network blocks Docker Hub, pre-pull the images:</p>
<p>&#8220;`bash<br />
docker pull python:3.12-slim node:22-alpine nginx:alpine postgres:16-alpine redis:7-alpine<br />
./build.sh docker<br />
&#8220;`</p>
<p>Or run compose directly:</p>
<p>&#8220;`bash<br />
docker compose up &#8211;build -d<br />
docker compose logs -f backend<br />
docker compose down -v<br />
&#8220;`</p>
<p>### Step 4 — Verify the Dashboard</p>
<p>Walk through these checks in the browser after `./build.sh demo`:</p>
<p>1. Command Center KPI cards show non-zero numbers (not dashes or zeros)<br />
2. Charts render with visible data points<br />
3. Drag a widget, refresh the page — layout stays where you left it<br />
4. <span data-ai-definition="performance">performance</span> page shows WebSocket as Connected with live points updating<br />
5. Template Gallery lists templates and Deploy Template creates a new board</p>
<p>**Success criteria:** `metric_samples > 0`, chart `points > 0`, E2E checks all pass, dashboard KPIs update after demo injection.</p>
<p>### Stop and Clean Up</p>
<p>When you are done for the day:</p>
<p>&#8220;`bash<br />
./stop.sh       # stop host processes and Docker containers<br />
./cleanup.sh    # remove node_modules, venv, caches, prune Docker resources<br />
&#8220;`</p>
<p>&#8212;</p>
<p>## Key Source Files</p>
<p>If you get lost in the codebase, start with these files.</p>
<p>| Path | Role |<br />
|&#8212;&#8212;|&#8212;&#8212;|<br />
| `backend/app/main.py` | FastAPI app, lifespan, router registration |<br />
| `backend/app/services/metrics_service.py` | Query, aggregate, chart data |<br />
| `backend/app/services/downsample.py` | LTTB downsampling |<br />
| `backend/app/services/cache_service.py` | Redis query cache |<br />
| `backend/app/services/seed.py` | Metric samples + default dashboard |<br />
| `backend/app/<span data-ai-definition="API">API</span>/<span data-ai-definition="performance">performance</span>.py` | WebSocket stream, Prometheus |<br />
| `frontend/src/pages/Console.tsx` | Main dashboard with grid + filters |<br />
| `frontend/src/components/dashboard/WidgetRenderer.tsx` | Chart widgets |<br />
| `frontend/src/components/dashboard/DashboardGrid.tsx` | react-grid-layout |<br />
| `frontend/src/<span data-ai-definition="API">API</span>/client.ts` | Typed <span data-ai-definition="API">API</span> client |<br />
| `frontend/src/hooks/useMetricsStream.ts` | WebSocket live updates |</p>
<p>&#8212;</p>
<p>## Troubleshooting</p>
<p>| Issue | Fix |<br />
|&#8212;&#8212;-|&#8212;&#8211;|<br />
| Port 5060/5230 in use | `./stop.sh` then retry |<br />
| Dashboard zeros | Run `./build.sh demo` or click refresh icon in UI |<br />
| Layout 409 conflict | Refresh page to get latest version |<br />
| Docker build fails | Use `./build.sh local` (hybrid mode) |<br />
| Stale node_modules | `./cleanup.sh` then `./build.sh local` |<br />
| Redis cache always miss | Ensure Redis container on :6440 |</p>
<p>&#8212;</p>
<p>## Assignment</p>
<p>Build a **custom widget type** `alert_summary` that displays the top 5 services by error-rate from the aggregated <span data-ai-definition="API">API</span>. Add it to the widget library, persist it on a dashboard, and verify layout survives page refresh.</p>
<p>### Solution Hints</p>
<p>1. Extend `WidgetRenderer` with a new case calling `/<span data-ai-definition="API">API</span>/v1/charts/aggregated?group_by=service`<br />
2. Register the type in `WidgetLibrary` with an appropriate icon<br />
3. POST to `/<span data-ai-definition="API">API</span>/v1/dashboards/{id}/widgets` with `widget_type: alert_summary`<br />
4. Confirm layout JSON in GET `/<span data-ai-definition="API">API</span>/v1/dashboards/{id}` includes your widget&#8217;s grid position</p>
<p>&#8212;</p>
<p>*Next: User &#038; Team Management — multi-tenant dashboards with RBAC inheritance.*</p>
</div>]]></content:encoded>
                                </item>
                <item>
            <title> - Hands-On Lesson</title>
            <link></link>
            <comments>#respond</comments>
            <pubDate></pubDate>
            <dc:creator><![CDATA[system11]]></dc:creator>
                        <guid isPermaLink="false"></guid>
            <description><![CDATA[## Lesson 9: Data Export &#038; Reporting Platform ## What We Are Building InfraWatch **Reports** — a production-grade export and reporting control plane: 1. **Export Engine** — Multi-format streaming exports... Master System Design and AI Agents with this hands-on tutorial.]]></description>
            <content:encoded><![CDATA[<div class="rss-content"><h3>Hands-On Lesson</h3><p>## Lesson 9:  Data Export &#038; Reporting Platform<br />
## What We Are Building</p>
<p>InfraWatch **Reports** — a production-grade export and reporting control plane:</p>
<p>1. **Export Engine** — Multi-format streaming exports (CSV, JSON, Excel, PDF) with checksum validation<br />
2. **Report Templates** — Jinja2-driven dynamic reports with preview and scheduled delivery<br />
3. **Visualization <span data-ai-definition="API">API</span>** — Chart endpoints with pre-aggregated hourly metrics and Redis <span data-ai-definition="caching">caching</span><br />
4. **Advanced Analytics** — Statistical baselines, anomaly detection, forecasting, and correlation matrices<br />
5. **<span data-ai-definition="performance">performance</span> Layer** — Query <span data-ai-definition="caching">caching</span>, index recommendations, Prometheus metrics, slow-query tracking<br />
6. **Operator Console** — Grafana-inspired dashboard with export wizard, real-time progress, and history</p>
<p>&#8212;</p>
<p>## Core Concept</p>
<p>Export systems in production (Datadog, Grafana, Splunk) never dump raw tables to users. They **stream, compress, and cache** query results because a single unbounded export can saturate <span data-ai-definition="database">database</span> I/O and starve live dashboards. The non-obvious insight: treat exports as **asynchronous jobs with TTL-bound artifacts**, not synchronous <span data-ai-definition="API">API</span> responses. Grafana&#8217;s report renderer and Datadog&#8217;s scheduled snapshots both follow this pattern — queue the work, stream batches, validate integrity, expire the file.</p>
<p>&#8212;</p>
<p>## Where This Fits</p>
<p>&#8220;`<br />
InfraWatch Realtime (live streams)<br />
        │<br />
InfraWatch Reports          ◀ this module<br />
        │<br />
InfraWatch Dashboard (widgets)<br />
&#8220;`</p>
<p>Reports consumes aggregated metrics and notification data upstream, producing downloadable artifacts and scheduled executive summaries downstream.</p>
<p>&#8212;</p>
<p>## Component Architecture</p>
<p>| Service | Port | Image | Role |<br />
|&#8212;&#8212;&#8212;|&#8212;&#8212;|&#8212;&#8212;-|&#8212;&#8212;|<br />
| backend | 5050 | Dockerfile | FastAPI <span data-ai-definition="API">API</span> + WebSocket progress |<br />
| frontend | 5220 | Dockerfile / Vite | Operator console |<br />
| postgres | 5480 | postgres:16-alpine | Metrics, jobs, templates |<br />
| redis | 6430 | redis:7-alpine | Chart query cache |</p>
<p>The <span data-ai-definition="API">API</span> sits in the middle. The React console talks to it over REST and WebSocket. PostgreSQL stores your metrics and export jobs. Redis caches chart queries so repeated dashboard loads do not hammer the <span data-ai-definition="database">database</span>.</p>
<p>&#8212;</p>
<p>## Inside the Project</p>
<p>Once you open the repository, the layout maps directly to those services:</p>
<p>&#8220;`<br />
infrawatch-reports/<br />
├── backend/<br />
│   ├── app/<br />
│   │   ├── main.py              # FastAPI app, lifespan, WebSocket<br />
│   │   ├── <span data-ai-definition="API">API</span>/                 # exports, templates, schedules, analytics<br />
│   │   ├── core/                # config, <span data-ai-definition="database">database</span><br />
│   │   ├── models/              # ExportJob, MetricSample, etc.<br />
│   │   ├── schemas/             # Pydantic request/response<br />
│   │   └── services/            # export_engine, analytics, cache, seed<br />
│   ├── tests/test_api.py<br />
│   └── requirements.txt<br />
├── frontend/<br />
│   ├── src/pages/               # 7 console pages<br />
│   ├── src/<span data-ai-definition="API">API</span>/client.ts<br />
│   └── package.json<br />
├── docker-compose.yml<br />
├── build.sh<br />
├── stop.sh<br />
└── cleanup.sh<br />
&#8220;`</p>
<p>You do not need to memorize every file. Focus on three folders: `<span data-ai-definition="API">API</span>/` (routes), `services/` (business logic), and `frontend/src/pages/` (what the operator sees).</p>
<p>&#8212;</p>
<p>## How the Pieces Work Together</p>
<p>**Export engine.** A POST to `/<span data-ai-definition="API">API</span>/v1/exports` creates a job. The job moves through `pending`, `processing`, and `completed` (or `failed` / `expired`). Rows stream in batches, the file gets an MD5 checksum, and downloads expire after 24 hours.</p>
<p>**Report templates.** Jinja2 templates support variable extraction, live preview, and scheduled generation. A weekly summary template is seeded on first startup.</p>
<p>**Analytics pipeline.** Raw metric samples roll up into hourly buckets. Chart endpoints check Redis first (60-second TTL), then PostgreSQL. Anomaly detection uses z-scores; forecasting uses linear regression; correlations use Pearson coefficients.</p>
<p>**<span data-ai-definition="performance">performance</span> layer.** In-memory cache plus Redis, latency histograms at P50/P95/P99, connection pool stats, and a Prometheus endpoint at `/<span data-ai-definition="API">API</span>/v1/<span data-ai-definition="performance">performance</span>/prometheus`.</p>
<p>&#8212;</p>
<p>## Control &#038; Data Flow</p>
<p>1. Operator selects data source and format in the export wizard<br />
2. <span data-ai-definition="API">API</span> checks Redis cache for chart queries; misses hit PostgreSQL with indexed scans<br />
3. Export engine streams rows in batches, writes file, computes MD5 checksum<br />
4. WebSocket pushes progress stages: fetching → converting → complete<br />
5. Completed files expire after 24 hours; Prometheus records latency percentiles</p>
<p>&#8212;</p>
<p>## Export Job Lifecycle</p>
<p>Every export job follows this path. If something breaks during processing, the job lands in `failed` with an error message. If nobody downloads within 24 hours, it moves to `expired`.</p>
<p>&#8212;</p>
<p>## <span data-ai-definition="API">API</span> Reference</p>
<p>### Exports</p>
<p>| Endpoint | Method | Purpose |<br />
|&#8212;&#8212;&#8212;-|&#8212;&#8212;&#8211;|&#8212;&#8212;&#8212;|<br />
| `/<span data-ai-definition="API">API</span>/v1/exports` | POST | Create export job |<br />
| `/<span data-ai-definition="API">API</span>/v1/exports` | GET | List jobs |<br />
| `/<span data-ai-definition="API">API</span>/v1/exports/{id}` | GET | Job status |<br />
| `/<span data-ai-definition="API">API</span>/v1/exports/{id}/download` | GET | Download file |<br />
| `/<span data-ai-definition="API">API</span>/v1/exports/{id}` | DELETE | Cancel job |</p>
<p>### Templates and Schedules</p>
<p>| Endpoint | Method | Purpose |<br />
|&#8212;&#8212;&#8212;-|&#8212;&#8212;&#8211;|&#8212;&#8212;&#8212;|<br />
| `/<span data-ai-definition="API">API</span>/v1/templates` | GET/POST | Template CRUD |<br />
| `/<span data-ai-definition="API">API</span>/v1/templates/{id}/preview` | POST | Render preview |<br />
| `/<span data-ai-definition="API">API</span>/v1/schedules` | GET/POST | Cron schedules |<br />
| `/<span data-ai-definition="API">API</span>/v1/schedules/run-due` | POST | Trigger due schedules |</p>
<p>### Analytics</p>
<p>| Endpoint | Purpose |<br />
|&#8212;&#8212;&#8212;-|&#8212;&#8212;&#8212;|<br />
| `GET /<span data-ai-definition="API">API</span>/v1/analytics/chart` | Multi-series chart data |<br />
| `GET /<span data-ai-definition="API">API</span>/v1/analytics/trends` | Direction, percent change, moving average |<br />
| `GET /<span data-ai-definition="API">API</span>/v1/analytics/compare` | Dimension comparison |<br />
| `GET /<span data-ai-definition="API">API</span>/v1/analytics/drilldown` | Channel to template hierarchy |<br />
| `GET /<span data-ai-definition="API">API</span>/v1/analytics/statistics/{metric}` | mean, p95, p99 |<br />
| `GET /<span data-ai-definition="API">API</span>/v1/analytics/anomalies` | z-score detection |<br />
| `GET /<span data-ai-definition="API">API</span>/v1/analytics/predictions/{metric}` | Forecast with confidence band |<br />
| `GET /<span data-ai-definition="API">API</span>/v1/analytics/correlations/{metric}` | Cross-metric Pearson r |</p>
<p>### Operations</p>
<p>| Endpoint | Purpose |<br />
|&#8212;&#8212;&#8212;-|&#8212;&#8212;&#8212;|<br />
| `GET /<span data-ai-definition="API">API</span>/v1/operations/overview` | Dashboard KPIs |<br />
| `POST /<span data-ai-definition="API">API</span>/v1/operations/demo` | Sample export |<br />
| `POST /<span data-ai-definition="API">API</span>/v1/operations/e2e` | Pipeline validation |</p>
<p>Quick <span data-ai-definition="API">API</span> check after the stack is running:</p>
<p>&#8220;`bash<br />
curl -s http://localhost:5050/<span data-ai-definition="API">API</span>/health<br />
curl -s http://localhost:5050/<span data-ai-definition="API">API</span>/v1/operations/overview | python3 -m json.tool<br />
&#8220;`</p>
<p>&#8212;</p>
<p>## Operator Console</p>
<p>The UI uses a Grafana-inspired dark theme. Each sidebar page maps to one part of the platform:</p>
<p>| Page | Route | What you will see |<br />
|&#8212;&#8212;|&#8212;&#8212;-|&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-|<br />
| Overview | `/` | 8 KPI cards and a delivery volume chart |<br />
| Exports | `/exports` | 3-step wizard and job table |<br />
| Templates | `/templates` | Jinja2 template cards |<br />
| Schedules | `/schedules` | Cron schedule table |<br />
| Analytics | `/analytics` | Comparison, trends, stats, anomalies, predictions, correlations |<br />
| <span data-ai-definition="performance">performance</span> | `/<span data-ai-definition="performance">performance</span>` | Latency percentiles, CPU, cache stats |<br />
| History | `/history` | Completed and failed export log |</p>
<p>Walk every page after startup. If KPIs show zero, run the demo step below before assuming something is broken.</p>
<p>&#8212;</p>
<p>## Build, Test and Demo</p>
<p>### Prerequisites</p>
<p>Python 3.12+, Node.js 22+, and Docker with Compose v2. Ports 5050, 5220, 5480, and 6430 must be free.</p>
<p>### Step 1 — Enter the project and make scripts executable</p>
<p>&#8220;`bash<br />
cd week9/infrawatch-reports<br />
chmod +x build.sh stop.sh cleanup.sh<br />
&#8220;`</p>
<p>### Step 2 — Run tests</p>
<p>&#8220;`bash<br />
./build.sh test<br />
&#8220;`</p>
<p>This runs 14 pytest cases (health, charts, exports, download, end-to-end) and 1 vitest case (UI renders). All should pass before you start the stack.</p>
<p>### Step 3 — Start the stack (hybrid mode, recommended)</p>
<p>Postgres and Redis run in Docker; <span data-ai-definition="API">API</span> and UI run on the host.</p>
<p>&#8220;`bash<br />
./build.sh local<br />
&#8220;`</p>
<p>Open **http://localhost:5220**. The <span data-ai-definition="API">API</span> listens on **http://localhost:5050**.</p>
<p>### Step 4 — Run the demo validation</p>
<p>With the stack running:</p>
<p>&#8220;`bash<br />
./build.sh demo<br />
&#8220;`</p>
<p>**Expected demo output:**</p>
<p>&#8220;`<br />
{&#8220;status&#8221;:&#8221;healthy&#8221;,&#8221;service&#8221;:&#8221;infrawatch-reports&#8221;}<br />
Metric samples: 2500+ | Delivery volume: >0<br />
{&#8220;passed&#8221;: true, &#8220;chart_points&#8221;: >0, &#8220;export_rows&#8221;: >0}<br />
Open http://localhost:5220<br />
&#8220;`</p>
<p>### Step 5 — Walk the UI manually</p>
<p>1. **Overview** — confirm KPI cards are not zero; click **Generate Sample Export**<br />
2. **Exports** — click Next twice, then **Start Export**; wait for the spinner; download the file<br />
3. **Analytics** — open each tab; charts should render with real data<br />
4. **<span data-ai-definition="performance">performance</span>** — CPU and latency values should update</p>
<p>### Full pipeline in one command</p>
<p>&#8220;`bash<br />
./build.sh all<br />
&#8220;`</p>
<p>Runs test, local start, and demo in sequence.</p>
<p>### With Docker (full stack)</p>
<p>&#8220;`bash<br />
./build.sh docker<br />
&#8220;`</p>
<p>Requires Docker Hub access for `python:3.12-slim`, `node:22-alpine`, and `nginx:alpine`. If Hub is unreachable, the script falls back to hybrid mode automatically.</p>
<p>Pre-pull images when your network is stable:</p>
<p>&#8220;`bash<br />
docker pull python:3.12-slim node:22-alpine nginx:alpine postgres:16-alpine redis:7-alpine<br />
./build.sh docker<br />
&#8220;`</p>
<p>On WSL, if you see `lookup registry-1.docker.io: no such host`:</p>
<p>&#8220;`bash<br />
echo &#8220;nameserver 8.8.8.8&#8221; | sudo tee /etc/resolv.conf<br />
&#8220;`</p>
<p>Restart Docker Desktop, then retry.</p>
<p>### Stop and clean up</p>
<p>&#8220;`bash<br />
./stop.sh        # stop host processes and compose stack<br />
./cleanup.sh     # remove node_modules, venv, caches, project Docker images<br />
&#8220;`</p>
<p>&#8212;</p>
<p>## Success Criteria</p>
<p>&#8211; [ ] `./build.sh test` — all backend and frontend tests pass<br />
&#8211; [ ] Overview KPIs show non-zero metric samples and delivery volume<br />
&#8211; [ ] Export wizard creates downloadable CSV/JSON/Excel/PDF files<br />
&#8211; [ ] Analytics tabs render comparison charts, trends, and correlations<br />
&#8211; [ ] <span data-ai-definition="performance">performance</span> page shows live CPU and query latency percentiles<br />
&#8211; [ ] Templates and schedules pages display seeded data</p>
<p>&#8212;</p>
<p>## Troubleshooting</p>
<p>| Issue | What to do |<br />
|&#8212;&#8212;-|&#8212;&#8212;&#8212;&#8212;|<br />
| Port 5050 in use | Run `./stop.sh`, then retry |<br />
| Export button seems dead | Complete all 3 wizard steps; wait for the exporting spinner |<br />
| Download shows server error | Restart backend; confirm export status is `completed` |<br />
| Docker build fails on Hub | Use `./build.sh local` instead |<br />
| Dashboard shows all zeros | Run `./build.sh demo` or **Generate Sample Export** |<br />
| Stale dependencies | Run `./cleanup.sh`, then `./build.sh local` |</p>
<p>&#8212;</p>
<p>## Key Files to Know</p>
<p>| Path | Role |<br />
|&#8212;&#8212;|&#8212;&#8212;|<br />
| `backend/app/main.py` | FastAPI app, lifespan, WebSocket |<br />
| `backend/app/services/export_engine.py` | Format writers, job processing |<br />
| `backend/app/services/analytics_service.py` | Charts, trends, statistical analysis |<br />
| `backend/app/services/cache_service.py` | Redis and memory cache |<br />
| `backend/app/services/seed.py` | Sample metric data on startup |<br />
| `frontend/src/pages/Exports.tsx` | Export wizard and download |<br />
| `frontend/src/pages/Analytics.tsx` | Six-tab analytics console |<br />
| `frontend/src/<span data-ai-definition="API">API</span>/client.ts` | <span data-ai-definition="API">API</span> client and export polling |</p>
<p>&#8212;</p>
<p>## Assignment</p>
<p>Add a custom report template that includes a bar chart of failure rates per channel. Schedule it to run every Monday at 08:00 UTC and deliver via email recipients list.</p>
<p>**Hints:** Create a Jinja2 template with a `{% for %}` loop over channel data. Use the `/<span data-ai-definition="API">API</span>/v1/analytics/compare` endpoint variables in the template context. Register a cron schedule via the Schedules <span data-ai-definition="API">API</span> with expression `0 8 * * 1`.</p>
<p>&#8212;</p>
<p>## Solution Hints</p>
<p>1. Fetch comparison data: `GET /<span data-ai-definition="API">API</span>/v1/analytics/compare?metric_name=failure_rate`<br />
2. POST to `/<span data-ai-definition="API">API</span>/v1/templates` with HTML containing `{% for item in channels %}`<br />
3. POST to `/<span data-ai-definition="API">API</span>/v1/schedules` with `cron_expression: &#8220;0 8 * * 1&#8243;` and `email_recipients: [&#8220;you@domain.com&#8221;]`<br />
4. Trigger manually: `POST /<span data-ai-definition="API">API</span>/v1/schedules/run-due` after setting `next_run_at` to past</p>
<p>&#8212;</p>
<p>*Next: Advanced Dashboard Features — drag-and-drop widgets consuming these chart APIs.*</p>
</div>]]></content:encoded>
                                </item>
                <item>
            <title> - Page Update</title>
            <link></link>
            <comments>#respond</comments>
            <pubDate></pubDate>
            <dc:creator><![CDATA[]]></dc:creator>
                        <guid isPermaLink="false"></guid>
            <description><![CDATA[]]></description>
            <content:encoded><![CDATA[<div class="rss-content"><h3>Page Update</h3></div>]]></content:encoded>
                                </item>
                <item>
            <title> - Digital Book</title>
            <link></link>
            <comments>#respond</comments>
            <pubDate></pubDate>
            <dc:creator><![CDATA[admin]]></dc:creator>
                        <guid isPermaLink="false"></guid>
            <description><![CDATA[About Distributed Systems with .NET This PDF is the lead magnet for Distributed Systems with .NET — a 45-post Substack series building one complete distributed log monitoring system in C#... Digital resource covering System Design and AI development topics.]]></description>
            <content:encoded><![CDATA[<div class="rss-content"><h3>Digital Book</h3>
<p class="wp-block-paragraph">About Distributed Systems with .NET</p>



<p class="has-medium-font-size wp-block-paragraph">This PDF is the lead magnet for <strong data-ai-concept="true">Distributed Systems with .NET</strong> — a 45-post Substack series building one complete distributed log monitoring system in C# on Windows, using .NET Aspire, Azure Service Bus, Azure Event Hubs, Application Insights, Azure Data Explorer, DAPR, and Bicep.</p>



<p class="has-medium-font-size wp-block-paragraph">Every Azure service runs on an official free Microsoft local emulator. No Azure subscription is required for any of the 45 posts.</p>
</div>]]></content:encoded>
                                </item>
                <item>
            <title> - System Design Course</title>
            <link></link>
            <comments>#respond</comments>
            <pubDate></pubDate>
            <dc:creator><![CDATA[Anjali]]></dc:creator>
                        <guid isPermaLink="false"></guid>
            <description><![CDATA[ Learn System Design, AI Agents, and Hands-On Development with practical projects.]]></description>
            <content:encoded><![CDATA[<div class="rss-content"><h3>System Design Course</h3></div>]]></content:encoded>
                                </item>
                <item>
            <title> - Page Update</title>
            <link></link>
            <comments>#respond</comments>
            <pubDate></pubDate>
            <dc:creator><![CDATA[admin]]></dc:creator>
                        <guid isPermaLink="false"></guid>
            <description><![CDATA[]]></description>
            <content:encoded><![CDATA[<div class="rss-content"><h3>Page Update</h3></div>]]></content:encoded>
                                </item>
                <item>
            <title> - System Design Course</title>
            <link></link>
            <comments>#respond</comments>
            <pubDate></pubDate>
            <dc:creator><![CDATA[admin]]></dc:creator>
                        <guid isPermaLink="false"></guid>
            <description><![CDATA[ Learn System Design, AI Agents, and Hands-On Development with practical projects.]]></description>
            <content:encoded><![CDATA[<div class="rss-content"><h3>System Design Course</h3></div>]]></content:encoded>
                                </item>
                <item>
            <title> - Newsletter Issue</title>
            <link></link>
            <comments>#respond</comments>
            <pubDate></pubDate>
            <dc:creator><![CDATA[admin]]></dc:creator>
                        <guid isPermaLink="false"></guid>
            <description><![CDATA[system design Interview Roadmap &#8211; Step by step process that will make you comfortable, familiar and then expert at system design. https://systemdr.substack.com/ https://sdcourse.substack.com https://aieworks.substack.com/ https://aiamastery.substack.com/ Latest insights on System Design, AI Agents, and software engineering.]]></description>
            <content:encoded><![CDATA[<div class="rss-content"><h3>Newsletter Issue</h3>
<p class="wp-block-paragraph"><span data-ai-definition="system design">system design</span> Interview Roadmap &#8211; Step by step process that will make you comfortable, familiar and then expert at <span data-ai-definition="system design">system design</span>.</p>



<p class="wp-block-paragraph"><a href="https://systemdr.substack.com/" rel="noopener">https://systemdr.substack.com/</a></p>



<p class="wp-block-paragraph"><a href="https://sdcourse.substack.com/subscribe" rel="noopener">https://sdcourse.substack.com</a></p>



<p class="wp-block-paragraph"><a href="https://aieworks.substack.com/" rel="noopener">https://aieworks.substack.com/</a></p>



<p class="wp-block-paragraph"><a href="https://aiamastery.substack.com/ 
" rel="noopener">https://aiamastery.substack.com/ <br></a></p>
</div>]]></content:encoded>
                                </item>
                
    </channel>
    </rss>
    