Task Overview Develop a RESTful API for an e-commerce platform with the following:
User Authentication
Register/Login (JWT-based)
Role-based access (Admin, Customer)
Product Management
CRUD for products (Only admins can add/remove products)
Products have: name, price, description, stock
Order Management
Customers can place orders
Orders have: items, total_price, status (pending, shipped, delivered)
Admins can update order status
Tech Stack You can pick based on what you're comfortable with, but a solid choice:
Backend: Python (FastAPI/Flask), Node.js (Express/NestJS), Go (Gin/Fiber)
Database: PostgreSQL, MySQL (or MongoDB if NoSQL is preferred)
Authentication: JWT-based auth
Tooling: Postman or Curl for testing
Interview Structure 💡 They will test how you structure your code, handle edge cases, and explain your decisions.
Set Up the Project (~10 mins)
Initialize the project (npm init, pip install fastapi, etc.)
Set up a minimal folder structure
Implement User Authentication (JWT) (~15–20 mins)
POST /register → Create user
POST /login → Authenticate user & return JWT
Middleware for protecting routes (admin, customer)
Build Product API (~15 mins)
POST /products → Admins add new products
GET /products → List all products
PUT /products/{id} → Update product details
DELETE /products/{id} → Remove a product (admin-only)
Build Order API (~20–25 mins)
POST /orders → Customer places an order
GET /orders/{id} → Fetch order details
PUT /orders/{id} → Admin updates order status
Error Handling & Optimization (~10 mins)
Handle bad requests, authentication failures, missing products
Use pagination for product listing (?page=1&size=10)
Use caching (optional, but shows system design thinking)
- caching
- api testing