controllers/
Request handling, one module per area.
Controllers own the product rules: no self-connections, no duplicate
requests, author-only deletes, poster-only application updates, messaging
only between connections or active job pairs. Anything worth telling the
user about goes through notifyUser, which stores the notification and
emits it into the recipient room.
What it owns
- Register, login, logout, profile, search, avatar and cover uploads
- GitHub OAuth login, callback, and profile sync
- Connection lifecycle: request, accept, reject, list, remove
- Posts: feed, create, like, comments, image upload
- Messages: history with pagination, send, conversations
- Jobs: listing, create, resume applications, status changes
- Notifications: the shared notify helper plus list and read routes
- Contact form: admin and confirmation mails
Files
File list and purposes from the folder README.
| File | Purpose |
|---|---|
authController.js | GitHub OAuth flow and profile sync. |
userController.js | JWT register/login plus profile and search. |
connectionController.js | Connection requests and lists. |
postController.js | Feed, posts, likes, comments. |
messageController.js | Chat history, REST send, conversations. |
notificationController.js | notifyUser helper plus notification routes. |
jobController.js | Listings, applications, status changes. |
contactController.js | Nodemailer contact form. |
Dependencies
| Library | Version range | Why it is used here |
|---|---|---|
| dotenv | ^16.5.0 | First line of index.js. |
| Socket.io Redis adapter | ^8.3.0 | Attached to the io server in utils/socket.js when pub/sub are ready. |
| ioredis | ^5.11.1 | Presence hash plus the pub/sub pair in config/redis.js. |
| Socket.io | ^4.7.4 | Server, rooms, and event handlers in utils/socket.js. |
| cookie-parser | ^1.4.7 | Cookie parsing in index.js, read by authMiddleware. |
| cors | ^2.8.5 | Permissive CORS in index.js and utils/socket.js. |
| Express | ^5.1.0 | App, router mounting, and static uploads in index.js. |
| express-rate-limit | ^8.5.2 | Auth, connection, search, post, and job limiters in middleware/rateLimiter.js. |
| Mongoose | ^8.14.1 | All six models plus the database.js connector. |
| Cloudinary | ^1.41.3 | Configuration in config/cloudinary.js; upload targets in middleware/upload.js. |
| Multer | ^2.0.1 | Avatar, post, cover, and document uploaders in middleware/upload.js. |
| multer-storage-cloudinary | ^4.0.0 | Cloud storage engines in middleware/upload.js. |
| Nodemailer | ^9.0.3 | Admin plus confirmation mails in contactController.js. |
| bcryptjs | ^2.4.3 | Pre-save hash and password check in models/User.js. |
| better-authDeclared but not used in source | ^1.6.23 | Declared in both manifests but never imported in any source file; authentication is JWT plus bcrypt. |
| jsonwebtoken | ^9.0.2 | Token issue in userController and authController; verified in authMiddleware. |
| validator | ^13.11.0 | Field validation in models/User.js. |
Dependencies as of commit cdef8af.
Talks to
Sources: backend/controllers/authController.js, backend/controllers/userController.js, backend/controllers/connectionController.js, backend/controllers/postController.js, backend/controllers/messageController.js, backend/controllers/notificationController.js, backend/controllers/jobController.js, backend/controllers/contactController.js (documented at commit cdef8af)