How kphuyal8979/dineflow works
DineFlow’s server is an Express API whose main workflow handles signup and login: route handlers validate credentials, delegate account operations, and return a user with a cookie token. A protected profile route verifies that token and loads the user; logout clears the cookie. Health checking is a separate API capability. The excerpts show these authentication calls, but not application/server wiring or database connection startup, so those links are omitted or marked unverified.
Main entry points: auth.controller.js Auth controller · auth.service.js Auth service · auth.middleware.js Token protection · env.js Environment config
Components 17
API entry points
- Auth routes
server/src/routes/auth.route.js - Health route
server/src/routes/health.route.js
Authentication
- Auth controller
server/src/controllers/auth.controller.js - Credential validation
server/src/validators/auth.validator.js - Auth service
server/src/services/auth.service.js - Token protection
server/src/middleware/auth.middleware.js - Token signing
server/src/utils/jwt.js
User identity
- User model
server/src/models/User.js - MongoDB
Runtime support
- Async wrapper
server/src/utils/async-handler.js - Auth errors
server/src/utils/app-error.js - Environment config
server/src/config/env.js - DB connector
server/src/lib/db.js - Error handling
server/src/middleware/error.middleware.js - Not-found handling
server/src/middleware/not-found.middleware.js - Rate limiter
server/src/lib/limiter.js
Other components
- API client
Connections 17
- API client → Auth routes: requests
- Auth routes → Auth controller: dispatches
server/src/routes/auth.route.js - Auth routes → Token protection: protects profile
server/src/routes/auth.route.js - Auth controller → Credential validation: validates input
server/src/controllers/auth.controller.js - Auth controller → Auth service: calls auth
server/src/controllers/auth.controller.js - Auth controller → Async wrapper: wraps handlers
server/src/controllers/auth.controller.js - Auth controller → API client: returns responses
server/src/controllers/auth.controller.js - Auth service → User model: reads and writes
server/src/services/auth.service.js - Auth service → Token signing: signs tokens
server/src/services/auth.service.js - Auth service → Auth errors: raises errors
server/src/services/auth.service.js - Token protection → User model: loads user
server/src/middleware/auth.middleware.js - Token protection → Environment config: reads secret
server/src/middleware/auth.middleware.js - Token protection → Auth controller: sets request user
server/src/routes/auth.route.js - User model → MongoDB: persists records
- Token signing → Environment config: reads secret
server/src/utils/jwt.js - Health route → Environment config: reads environment
server/src/routes/health.route.js - DB connector → Environment config: reads connection URI
server/src/lib/db.js