Capstone · Backend Development
Capstone: the orders backend of a grocery app
The brief
Build the backend of Kirana Orders, a neighbourhood grocery delivery app in Pune: design the database, migrate the shop's old spreadsheet, place orders in transactions, report bills with a view, then write the API (validation, pricing with GST, JWT login, permissions, one complete endpoint) and run it for real in Node.js and in a Docker container.
Why it matters
This is the whole job of a backend developer in one project, and exactly what to walk an interviewer through: a schema with constraints, a data migration, transactions, money in paise, token-based auth, role checks, clear errors, and a container you can deploy anywhere. Quick-commerce and kirana-tech startups hire for these skills every month.
Skills you practise
- schema design with constraints
- data migration with INSERT … SELECT
- transactions
- views for reports
- validation and 400/409
- money in paise and GST
- JWT (HS256) with Web Crypto
- role-based permissions
- Express
- Docker
You need
- Node.js 20 or newer and npm
- Docker Desktop (Windows/macOS) or Docker Engine (Linux)
- curl (built into Windows 10/11 as curl.exe, macOS and Linux)
What you will have at the end
A GitHub repository with db.sql, api.js, server.js, a Dockerfile and a README: a working, secured orders API you can run with one docker run command and explain in an interview.
How it is marked (rubric, 100 points)
| Works end to endEvery check passes and the API runs in Node.js and in Docker. | 30 |
|---|---|
| Data designConstraints in the schema, money in paise, prices copied into order lines, a transaction for orders, one view for bills. | 20 |
| SecurityVerified HS256 tokens (no "none"), deny-by-default permissions, validation of every field, secrets only in the environment. | 25 |
| Code qualitySmall functions, consistent error shape, ctx passed in for testability. | 10 |
| DocumentationA README with setup, endpoints, example requests and design decisions. | 15 |
0/11 steps done
Step 1 of 11
Design the tables
db.sql creates products (id, name, price_paise, gst_rate, stock), customers (id, name, phone), orders (id, customer_id, status, created_at) and order_items (order_id, product_id, qty, price_paise, gst_rate), with the columns in this order, NOT NULL on every column except the id keys, and a composite primary key (order_id, product_id).
Constraints are rules the database enforces even when the code has a bug. Store money as whole paise (INTEGER) so totals are exact. Add CHECKs: price above 0, gst_rate one of 0, 5, 18, 40, stock never below 0, status one of placed, packed, delivered, cancelled. Make names and phone numbers UNIQUE where they must be.
order_items copies price_paise and gst_rate at the moment of the order: if the price of dal goes up next week, last week's bills must not change. Its primary key is the pair (order_id, product_id), so a product appears once per order.
Run shows what your code prints. Check runs the step's tests. Ctrl+Enter checks too.