How c0braaaa/cflix-backend works
CFlix is a movie-platform backend API. Clients enter through Express routes, which dispatch to request controllers and domain services for authentication, user collections, movie engagement, administration, traffic, and AI recommendations; services use MongoDB-backed models. The README also documents Socket.IO updates and Google/Groq chatbot integrations. Edges follow the supplied excerpts, SOURCE INDEX references, or README; unsampled subsystem links are omitted rather than inferred.
Main entry points: mongodb.js MongoDB connection · server.js HTTP and sockets · authServices.js Auth and recovery · index.js V1 API router
Components 29
API entry
- HTTP and sockets
src/server.js - V1 API router
src/routes/v1/index.js - Auth routes
src/routes/v1/authRoute.js - User routes
src/routes/v1/userRoute.js - Report routes
src/routes/v1/reportRoute.js
Identity and users
- Token and role checks
src/middlewares/authMiddleware.js - Authentication handlers
src/controllers/authController.js - Auth and recovery
src/services/authServices.js - User handlers
src/controllers/userController.js - Profiles and collections
src/services/userServices.js
Movie engagement
- Comment handlers
src/controllers/commentController.js - Comment operations
src/services/commentServices.js - Ratings
src/services/ratingServices.js - Trending views
src/services/viewsService.js - AI recommendations
src/services/chatbotService.js
Platform operations
- Report handling
src/controllers/reportController.js - Report operations
src/services/reportService.js - Notifications
src/services/notificationService.js - Email delivery
src/utils/email.js
Persistence
- User records
src/models/userModels.js - User interactions
src/models/interactionsModel.js - Comments
src/models/commentModel.js - View records
src/models/viewsModel.js - Reports
src/models/reportModel.js - Notification records
src/models/notificationModel.js - MongoDB connection
src/config/mongodb.js
Other components
- API client
- Google OAuth
- Socket.IO clients
Connections 38
- API client → HTTP and sockets: sends requests
src/server.js - HTTP and sockets → V1 API router: mounts API
src/server.js - V1 API router → Auth routes: mounts routes
src/routes/v1/index.js - V1 API router → User routes: mounts routes
src/routes/v1/index.js - V1 API router → Report routes: mounts routes
src/routes/v1/index.js - Auth routes → Authentication handlers: dispatches to
src/routes/v1/authRoute.js - Auth routes → Token and role checks: guards password change
src/routes/v1/authRoute.js - User routes → User handlers: dispatches to
src/routes/v1/userRoute.js - User routes → Token and role checks: guards routes
src/routes/v1/userRoute.js - Report routes → Report handling: dispatches to
src/routes/v1/reportRoute.js - Report routes → Token and role checks: guards routes
src/routes/v1/reportRoute.js - Authentication handlers → Auth and recovery: calls
src/controllers/authController.js - Auth and recovery → User records: reads and writes
src/services/authServices.js - Auth and recovery → Email delivery: sends recovery email
src/services/authServices.js - User handlers → Profiles and collections: calls
src/controllers/userController.js - Profiles and collections → User records: manages profiles
src/services/userServices.js - Profiles and collections → User interactions: manages collections
src/services/userServices.js - Token and role checks → HTTP and sockets: reads JWT secret
src/middlewares/authMiddleware.js - Comment handlers → Comment operations: calls
src/controllers/commentController.js - Comment operations → Comments: accesses comments
src/services/commentServices.js - Comment handlers → Notifications: requests notifications
src/controllers/commentController.js - Notifications → Comments: reads comment
src/services/notificationService.js - Notifications → Notification records: creates notifications
src/services/notificationService.js - Ratings → HTTP and sockets: uses rating API
- Trending views → View records: queries views
src/services/viewsService.js - AI recommendations → Trending views: uses view data
src/services/chatbotService.js - Report handling → Report operations: calls
src/controllers/reportController.js - Report operations → Reports: manages reports
src/services/reportService.js - HTTP and sockets → MongoDB connection: connects before serving
src/server.js - MongoDB connection → Auth and recovery: provides database access
- MongoDB connection → Comments: provides database access
src/models/commentModel.js - MongoDB connection → User records: provides database access
src/models/userModels.js - MongoDB connection → User interactions: provides database access
src/models/interactionsModel.js - MongoDB connection → View records: provides database access
src/models/viewsModel.js - MongoDB connection → Reports: provides database access
src/models/reportModel.js - Auth and recovery → Google OAuth: verifies identity
src/services/authServices.js - HTTP and sockets → Socket.IO clients: broadcasts presence
src/server.js - User handlers → Socket.IO clients: emits account events
src/controllers/userController.js