Capstone — Build a Real Database-Backed System Capstone
কোর্সের শেষ চ্যালেঞ্জ — সম্পূর্ণ একটি system নিজে গড়ে তুলুন
1. From SELECT 1; to a Real System
You started this course with a single SELECT. Across 39 modules you learned to design
schemas, write any SQL query, reason about transactions, indexes, and query plans, and tell the
difference between SQL and NoSQL. The capstone is where you bring it together.
Pick one of the four tracks below. Each is sized for two to six weeks of evening work and produces something you can put on GitHub, show in interviews, and explain end-to-end.
2. The Four Tracks
Track A — Mini SQL Engine
- Best for: language & systems lovers.
- Implement
CREATE,INSERT,SELECTwithWHERE,ORDER BY,LIMIT. - Persist tables as files; one B-tree index.
- Tools: any language (Python, Go, C, Rust, JS).
Track B — Full-Stack Postgres App
- Best for: web/full-stack engineers.
- Build a small e-commerce or library app: schema, API, web UI.
- Use parameterized queries, transactions, and indexes.
- Tools: Postgres + any web stack (Next.js, Django, Spring).
Track C — Analytics Dashboard (Star Schema)
- Best for: data engineers / analysts.
- Take a public dataset; design fact + dimensions; build dashboards.
- Practice window functions, GROUP BY, materialized views.
- Tools: Postgres / DuckDB / BigQuery + Metabase / Superset.
Track D — Tiny Key-Value Store
- Best for: low-level / NoSQL fans.
- Implement an LSM-tree-backed KV store:
get,set,delete,scan. - WAL for durability; compaction in the background.
- Tools: any systems language.
3. Track A — Mini SQL Engine (Spec)
Goal. Write a working, single-file SQL engine that supports a useful subset of the language.
Required features
CREATE TABLE name(col TYPE, col TYPE PRIMARY KEY, ...)— TYPE in {INT, TEXT}.INSERT INTO name VALUES (...)— single-row at minimum.SELECT col, ... FROM name [WHERE cond] [ORDER BY col [DESC]] [LIMIT n]- Persistence: each table backed by a file on disk (e.g. JSON-lines or a custom binary format).
- One B-tree index per primary key, used to speed up
WHERE pk = ?. - REPL with a read-eval-print loop; multi-line statements terminated by
;.
Stretch goals
UPDATEandDELETE.- Support a single inner
JOIN(nested-loop is fine). - Print an
EXPLAINfor any query before executing it. - Add
BEGIN/COMMIT/ROLLBACKwith an in-memory transaction layer.
4. Track B — Full-Stack Postgres App (Spec)
Goal. Ship a small but real database-backed web application — properly modeled, properly queried, properly secured.
Required features
- Pick a domain (mini Daraz, library, gym, freelance marketplace, anything you can describe in two sentences).
- ER diagram → 3NF Postgres schema, as a numbered set of migration files.
- At least 5 user-facing pages; every read/write goes through parameterized SQL.
- Transactions wrap any multi-statement workflow (e.g. checkout, refund, return).
- Indexes designed deliberately, not by accident — document each one.
- Authentication with hashed passwords (bcrypt or argon2) and a least-privilege DB user.
- Daily backup + a one-page runbook for restore.
Stretch goals
- Add a read-replica and route reports to it.
- Add full-text search on one entity (Postgres
tsvector). - Deploy to a free tier (Railway, Render, Fly.io, Supabase).
-- A starter library schema you can build on. Runs in our in-browser SQLite.
CREATE TABLE member(
id INTEGER PRIMARY KEY,
name TEXT NOT NULL,
email TEXT NOT NULL UNIQUE,
joined_at TEXT NOT NULL
);
CREATE TABLE book(
id INTEGER PRIMARY KEY,
isbn TEXT NOT NULL UNIQUE,
title TEXT NOT NULL,
author TEXT NOT NULL,
total_copies INTEGER NOT NULL CHECK(total_copies >= 0)
);
CREATE TABLE loan(
id INTEGER PRIMARY KEY,
member_id INTEGER NOT NULL REFERENCES member(id),
book_id INTEGER NOT NULL REFERENCES book(id),
borrowed_at TEXT NOT NULL,
due_at TEXT NOT NULL,
returned_at TEXT
);
CREATE INDEX idx_loan_member ON loan(member_id);
CREATE INDEX idx_loan_open ON loan(returned_at) WHERE returned_at IS NULL;
INSERT INTO member VALUES
(1,'Arif','arif@univ.bd','2025-08-01'),
(2,'Mim','mim@univ.bd','2025-09-12');
INSERT INTO book VALUES
(1,'978-0','Database Internals','A. Petrov',2),
(2,'978-1','Designing Data-Intensive Applications','M. Kleppmann',3);
INSERT INTO loan(id,member_id,book_id,borrowed_at,due_at) VALUES
(1,1,1,'2026-04-25','2026-05-09'),
(2,2,2,'2026-04-30','2026-05-14');
-- Example query: every book currently on loan, with the borrower.
SELECT b.title, m.name AS borrower, l.due_at
FROM loan l
JOIN book b ON b.id = l.book_id
JOIN member m ON m.id = l.member_id
WHERE l.returned_at IS NULL;
5. Track C — Analytics Dashboard (Star Schema)
Goal. Take a real public dataset and turn it into an analytics-ready warehouse with dashboards.
Suggested datasets
- Bangladesh Open Data — population, education, weather.
- NYC Taxi trips (subset).
- Olist Brazilian e-commerce orders (Kaggle).
- Your own university's exam results (with permission & PII removed).
Required features
- Design a star schema: 1 fact table + 3–5 dimension tables.
- Loader script that ingests raw CSV / JSON into the schema (idempotent).
- 5 analytical queries — each using at least one of: window function, CTE, GROUP BY, multi-join.
- Dashboard: Metabase / Superset / Looker Studio with at least 5 widgets.
- Document each query: what it answers, how long it takes, what index it uses.
6. Track D — Tiny Key-Value Store
Goal. Build a tiny but durable KV store, see how RocksDB and Cassandra think.
Required features
- API:
set(key, value),get(key),delete(key),scan(prefix). - In-memory memtable (sorted map). Periodically flushed to disk as an SSTable.
- Write-ahead log so crashes do not lose acknowledged
sets. - Background compaction that merges multiple SSTables and drops tombstoned keys.
- Benchmark: 1 M random writes/sec target on commodity hardware (achievable with batching).
7. Deliverables — Same For Every Track
- README.md — what, why, how to run, screenshots.
- Schema — version-controlled migration files / formal schema docs.
- Seed data — at least one realistic seed dataset and a script that loads it.
- Tests — at minimum a few integration tests of the critical paths.
- Benchmarks / EXPLAIN — for any query or operation in the hot path.
- One-page architecture write-up — what you chose, what you didn't, why.
- Public repo — push to GitHub. This is the artifact you show off.
8. Self-Review Rubric
| Area | What "done" looks like |
|---|---|
| Schema | 3NF (or BCNF) where appropriate, every constraint named, every FK declared. |
| SQL discipline | Every query parameterized, no string concat anywhere. |
| Performance | Each hot query under 50 ms on seed data; EXPLAIN committed. |
| Transactions | Every multi-statement workflow wrapped; error path tested. |
| Indexing | Each index has a one-line justification. |
| Backups | Restore drill executed at least once and documented. |
| Documentation | A new dev can clone & run within 10 minutes from the README. |
| Code quality | Linted, formatted, small files, meaningful names. |
9. Idea Bank — Pick & Adapt
If none of the four tracks excites you, pick from the menu below and align it with one track:
- BD-shipping tracker — courier & parcel events, ETA computation. (Track B / C)
- Mini bKash ledger — user wallets, signed transactions, daily reconciliation. (Track B)
- Bus-route planner DB — recursive CTE to find paths. (Track B)
- Bangla SMS spam analytics — fact/dim schema, dashboards. (Track C)
- SQLite WASM playground — like this course's runner, but with persistence. (Track A/B)
- Tiny Redis clone — TCP server speaking RESP. (Track D)
- Time-series DB — store sensor readings; downsample on read. (Track A/D)
- Mini search engine — inverted index in SQL, ranked queries. (Track B/C)
Summary — Module 40 (Capstone)
This is the end of the syllabus and the beginning of your portfolio. The capstone is not graded by anyone but you and the reviewers you choose to show it to. Your only obligations are: finish something, write it down, and publish it. A small, complete, runnable project beats a beautiful, half-finished one — every time.
We started 40 modules ago with the question "Why databases?". After CREATE, SELECT, JOIN, normalization, transactions, indexes, optimization, NoSQL — you should now be able to answer that question yourself, in your own words, in two languages, with code.