How nikhil3113/billeasy-assessment works
Project type and purpose
• This is a backend‐only, RESTful API service for managing books and reviews.
• Tech stack: Node.js + Express (HTTP server), MongoDB (database), Prisma (ORM), JWT (authentication).
File structure
• src/server.ts: entry point, sets up Express and mounts routes.
• src/routes/*.ts: defines HTTP endpoints for users, books, reviews.
• src/controller/*.ts: implements business logic for each resource.
• src/middleware/auth.ts: enforces JWT authentication on protected routes.
• src/prisma.ts + src/generated/prisma: Prisma client setup and generated code.
• prisma/schema.prisma: data model definitions.
README for additional insights
• Confirms layered architecture: HTTP server → routing → controllers → ORM → database
• JWT secret is stored in env vars; database URL likewise.
• No UI/front end—clients consume JSON over HTTP.
a. Main components:
• Client (e.g. browser, mobile app, Postman)
• API Server (Express app)
• Routing Layer
• Middleware Layer (Auth)
• Controller Layer (User, Book, Review controllers)
• Data Access Layer (Prisma ORM)
• Database: MongoDB
b. Relationships & data flow:
1) Client → HTTP request → Express Router
2) Router → [Auth Middleware] → Controller
3) Controller → Prisma Client → MongoDB
4) MongoDB → Prisma → Controller → HTTP response → Client
c. Architectural patterns & principles:
• Layered (Controller, Middleware, Data Access)
• Separation of concerns (routing vs business logic vs data logic)
• Stateless authentication via JWT
• Modular file organization by resource
d. Key technologies & libraries:
• Express: HTTP server & routing
• Prisma: type‐safe ORM connecting Node.js to MongoDB
• MongoDB: document database
• jsonwebtoken: JWT creation/verification