How parthsabhaya18/nexity-backend works
Nexity Backend is an Express REST API. Its principal workflow accepts an HTTP request, routes it to a feature controller, validates and executes authentication logic, accesses MongoDB-backed models, and returns a response; OTP email supports verification and password recovery. The visible implementation centers on authentication, user accounts, and health/readiness checks rather than the broader social-app features described in documentation. Relationships reflect the README and source-index references; unsampled modules are represented only where their wiring is evidenced.
Main entry points: auth.service.ts Auth workflows · otp.service.ts OTP service · app.ts Express app · index.ts API router
Components 22
HTTP runtime
- Server lifecycle
src/server.ts - Express app
src/app.ts - API router
src/routes/index.ts - Error handling
src/middlewares/errorHandler.ts
Identity and sessions
- Auth routes
src/modules/auth/auth.routes.ts - Auth controller
src/modules/auth/auth.controller.ts - Auth validation
src/modules/auth/auth.schema.ts - Auth workflows
src/modules/auth/auth.service.ts - OTP service
src/modules/auth/otp.service.ts - Token service
src/modules/auth/tokens.ts - Auth middleware
src/middlewares/requireAuth.ts
Persistence
- User model
src/modules/users/user.model.ts - Refresh token model
src/modules/auth/refreshToken.model.ts - OTP code model
src/modules/auth/otpCode.model.ts - MongoDB connection
src/config/database.ts - Health check model
src/modules/health/healthCheck.model.ts
Health and messaging
- Health routes
src/modules/health/health.routes.ts - Health checks
src/modules/health/health.controller.ts - Mail delivery
src/utils/mailer.ts - OTP email layout
src/utils/emailLayout.ts
Other components
- API client
- SMTP service
Connections 23
- API client → Express app: sends requests
README.md - Server lifecycle → MongoDB connection: connects before listening
src/server.ts - Server lifecycle → Express app: creates and serves
src/server.ts - Express app → API router: mounts routes
src/app.ts - Express app → Error handling: registers handlers
src/app.ts - API router → Auth routes: mounts router
src/routes/index.ts - API router → Health routes: mounts router
src/routes/index.ts - Auth routes → Auth controller: dispatches requests
src/modules/auth/auth.routes.ts - Auth controller → Auth validation: validates input
src/modules/auth/auth.controller.ts - Auth controller → Auth workflows: calls workflows
src/modules/auth/auth.controller.ts - Auth workflows → User model: reads and writes
src/modules/auth/auth.service.ts - Auth workflows → OTP service: requests codes
src/modules/auth/auth.service.ts - Auth workflows → Token service: issues and revokes
src/modules/auth/auth.service.ts - Token service → Refresh token model: stores sessions
src/modules/auth/tokens.ts - OTP service → OTP code model: stores codes
src/modules/auth/otp.service.ts - OTP service → OTP email layout: renders email
src/modules/auth/otp.service.ts - OTP service → Mail delivery: sends email
src/modules/auth/otp.service.ts - Mail delivery → SMTP service: delivers through
README.md - Auth middleware → Token service: verifies tokens
src/middlewares/requireAuth.ts - Auth middleware → User model: loads user
src/middlewares/requireAuth.ts - Health routes → Health checks: dispatches checks
src/modules/health/health.routes.ts - Health checks → MongoDB connection: checks connection
src/modules/health/health.controller.ts - Health checks → Health check model: reads and writes checks
src/modules/health/health.controller.ts