How antonessam28/saraha-app works
This is an Express/Mongoose backend for a Saraha-style application. Requests enter through the server and feature routes; the documented-in-source authentication workflow validates input, invokes auth services, persists users and OTPs, and may send verification email or verify Google credentials. User and message routes are also mounted, but their internal behavior is not established by the available excerpts. The graph preserves those product areas while limiting their internal links; relationships are based on shown calls or SOURCE INDEX references.
Main entry points: auth.service.js Auth workflows · main.js Express server · auth.controller.js Auth controller · auth.route.js Auth routes
Components 28
HTTP runtime
- Express server
src/main.js
Authentication
- Auth routes
src/app/auth/auth.route.js - Auth controller
src/app/auth/controller/auth.controller.js - Auth schemas
src/app/auth/dto/auth.dto.js - Auth workflows
src/app/auth/service/auth.service.js - Auth repository
src/app/auth/repository/auth.repository.js - OTP repository
src/app/auth/repository/otp.repsoitory.js - OTP model
src/app/auth/model/otp.model.js - Password hashing
src/app/auth/utils/hash.js - Token generation
src/app/auth/utils/token.js
User domain
- User routes
src/app/user/user.route.js - User controller
src/app/user/controller/user.controller.js - User service
src/app/user/service/user.service.js - User repository
src/app/user/repository/user.repository.js - User model
src/app/user/model/user.model.js
Messaging
- Message routes
src/app/message/message.route.js - Message controller
src/app/message/controller/message.controller.js - Message service
src/app/message/service/message.service.js - Message repository
src/app/message/repository/message.repository.js - Message model
src/app/message/model/message.model.js
Shared services
- Body validation
src/common/validation/validation.js - Mongo connection
src/common/db/mongoose.js - Email sender
src/common/email/nodemailer.js - Google token check
src/common/utils/google-auth.js - Error handling
src/common/error/error.js
Other components
- API client
- Gmail SMTP
- Google identity
Connections 22
- API client → Express server: sends requests
src/main.js - Express server → Auth routes: mounts at /auth
src/main.js - Express server → User routes: mounts at /user
src/main.js - Express server → Message routes: mounts at /message
src/main.js - Express server → Mongo connection: loads connection
src/main.js - Express server → Error handling: handles errors
src/main.js - Auth routes → Auth controller: dispatches requests
src/app/auth/auth.route.js - Auth controller → Body validation: validates bodies
src/app/auth/controller/auth.controller.js - Auth controller → Auth schemas: uses schemas
src/app/auth/controller/auth.controller.js - Auth controller → Auth workflows: invokes workflows
src/app/auth/controller/auth.controller.js - Auth workflows → Auth repository: checks and creates users
src/app/auth/service/auth.service.js - Auth workflows → OTP repository: manages OTP records
src/app/auth/service/auth.service.js - Auth workflows → User repository: updates users
src/app/auth/service/auth.service.js - Auth repository → User model: queries users
src/app/auth/repository/auth.repository.js - User repository → User model: updates records
src/app/user/repository/user.repository.js - OTP repository → OTP model: uses OTP model
src/app/auth/repository/otp.repsoitory.js - Auth workflows → Password hashing: hashes passwords
src/app/auth/service/auth.service.js - Auth workflows → Token generation: generates tokens
src/app/auth/service/auth.service.js - Auth workflows → Email sender: sends OTP email
src/app/auth/service/auth.service.js - Email sender → Gmail SMTP: sends mail
- Auth workflows → Google token check: verifies Google token
src/app/auth/service/auth.service.js - Google token check → Google identity: checks identity token