How sc-designs/user-microservice-a.i. works
This repository implements the User Microservice within the wider AI Interviewer platform, rather than the interview, AI-evaluation, or results workflow itself. Its principal flow is gateway-routed user requests through authentication and route handlers to account services and user records, with OTP email, profile-image storage, and session revocation as supporting capabilities. The README describes wider platform features, but their services are not present in this tree. Edges below are limited to relationships visible in excerpts or explicitly documented; unsampled route-handler details are not inferred.
Main entry points: user.controller.js Account handlers · user.router.js User routes · app.js HTTP application · user.service.js Registration service
Components 23
API entry
- HTTP application
app.js - User routes
routes/user.router.js - Request validation
config/Zod.cheker.js - Async route wrapper
utils/tryCatch.js
Identity and accounts
- Account handlers
controllers/user.controller.js - Registration service
services/user.service.js - User lookup
utils/userFinder.js - User model
models/user.model.js - User authentication
middleware/isLoggedInUser.js - Admin authentication
middleware/isAdminLoggedIn.js - Organization authentication
middleware/isOrgLoggedIn.js - Analytics grouping
utils/GetGroupStage.js - User data cleanup
utils/cleanUpUser.js - Error types
utils/errors.js
External services
- MongoDB
- Token blacklist
services/redis.service.js - OTP email
utils/EmailSender.js - Image upload
db/cloudinary-connection.js - Cloudinary
- Admin service
- Result service
services/result.service.js
Other components
- Gateway
- API client
Connections 28
- API client → Gateway: sends requests
README.md - Gateway → HTTP application: routes requests
README.md - HTTP application → User routes: mounts routes
app.js - HTTP application → MongoDB: connects
app.js - HTTP application → Request validation: loads config
app.js - User routes → Account handlers: dispatches
routes/user.router.js - User routes → Async route wrapper: wraps handlers
routes/user.router.js - User routes → User authentication: guards routes
routes/user.router.js - User routes → Admin authentication: guards routes
routes/user.router.js - User routes → Organization authentication: guards routes
routes/user.router.js - Account handlers → Registration service: registers user
controllers/user.controller.js - Registration service → User model: creates user
services/user.service.js - User model → MongoDB: persists records
- Account handlers → User lookup: finds users
controllers/user.controller.js - User lookup → User model: queries
utils/userFinder.js - User authentication → User lookup: loads identity
middleware/isLoggedInUser.js - User authentication → Token blacklist: checks blacklist
middleware/isLoggedInUser.js - Account handlers → Token blacklist: blacklists token
controllers/user.controller.js - Account handlers → OTP email: sends OTP
controllers/user.controller.js - Account handlers → Image upload: uploads avatar
controllers/user.controller.js - Image upload → Cloudinary: stores image
db/cloudinary-connection.js - Admin authentication → Admin service: checks admin
middleware/isAdminLoggedIn.js - Admin authentication → Request validation: reads config
middleware/isAdminLoggedIn.js - Organization authentication → Request validation: reads config
middleware/isOrgLoggedIn.js - Account handlers → Analytics grouping: builds grouping
controllers/user.controller.js - Account handlers → User data cleanup: sanitizes profile
controllers/user.controller.js - Registration service → Error types: throws errors
services/user.service.js - Account handlers → Result service: uses result service