How mohithalduniya/backend works
Nestro is an Express API for a home-furnishings storefront and its administration: clients call category, room, product, user, and order endpoints, which route to controllers and persist domain records in MongoDB. The main customer workflow covers account registration and OTP verification, browsing catalog data, and placing and reviewing orders; administrative endpoints manage catalog records and order status. The graph also includes authentication, image upload, and response helpers. Several controllers and route modules are represented from the source index; their unsampled internals are not inferred.
Main entry points: index.js Express API · user.controller.js Account workflows · product.controller.js Product management · order.controller.js Order workflows
Components 23
API routing
- Express API
src/index.js - Category routes
src/routers/category.router.js - Room routes
src/routers/room.router.js - Product routes
src/routers/product.router.js - User routes
src/routers/user.router.js - Order routes
src/routers/order.router.js
Accounts and access
- Auth middleware
src/Middleware/auth.middleware.js - Account workflows
src/controllers/user.controller.js - User records
src/models/user.model.js - Token and OTP helpers
src/utils/helper.js - OTP email sender
src/utils/sendOtpMail.js
Store catalog
- Category management
src/controllers/Category.controller.js - Category records
src/models/category.model.js - Room management
src/controllers/room.controller.js - Room records
src/models/Room.model.js - Product management
src/controllers/product.controller.js - Product records
src/models/product.model.js - Image upload
src/Middleware/Middleware.js
Orders and support
- Order workflows
src/controllers/order.controller.js - Order records
src/models/order.model.js - HTTP response helpers
src/utils/response.js
Other components
- Store client
- Cloudinary
src/config/cloudinary.js
Connections 31
- Store client → Express API: calls API
src/index.js - Express API → Category routes: mounts routes
src/index.js - Express API → Room routes: mounts routes
src/index.js - Express API → Product routes: mounts routes
src/index.js - Express API → User routes: mounts routes
src/index.js - Express API → Order routes: mounts routes
src/index.js - Category routes → Category management: dispatches to
src/routers/category.router.js - Room routes → Room management: dispatches to
src/routers/room.router.js - Product routes → Product management: dispatches to
src/routers/product.router.js - Product routes → Image upload: uploads images
src/routers/product.router.js - Category routes → Image upload: uses upload
src/routers/category.router.js - User routes → Account workflows: dispatches to
src/routers/user.router.js - User routes → Auth middleware: checks access
src/routers/user.router.js - Order routes → Order workflows: dispatches to
src/routers/order.router.js - Order routes → Auth middleware: checks access
src/routers/order.router.js - Auth middleware → User records: loads user
src/Middleware/auth.middleware.js - Account workflows → User records: reads and writes
src/controllers/user.controller.js - Account workflows → Token and OTP helpers: generates OTP and tokens
src/controllers/user.controller.js - Account workflows → OTP email sender: sends OTP email
src/controllers/user.controller.js - Category management → Category records: manages records
src/controllers/Category.controller.js - Room management → Room records: manages records
src/controllers/room.controller.js - Product management → Product records: manages records
src/controllers/product.controller.js - Product management → Category records: filters by category
src/controllers/product.controller.js - Product management → Room records: filters by room
src/controllers/product.controller.js - Image upload → Cloudinary: stores images
src/Middleware/Middleware.js - Order workflows → Order records: creates and queries
src/controllers/order.controller.js - Order workflows → User records: reads and updates user
src/controllers/order.controller.js - Category management → HTTP response helpers: formats responses
src/controllers/Category.controller.js - Product management → HTTP response helpers: formats responses
src/controllers/product.controller.js - Account workflows → HTTP response helpers: formats responses
src/controllers/user.controller.js - Order workflows → HTTP response helpers: formats responses
src/controllers/order.controller.js