How hasibulhasanjoy/talkwide-backend works
Talkwide is a social discussion backend. The main workflow accepts client HTTP requests, mounts API routes, and handles domain operations such as authentication, posts, comments, communities, and search before returning JSON responses. The documented architecture separates middleware, controllers, services, and Mongoose models; sampled controller imports and calls substantiate several domain-service links. The README documents additional capabilities, including feeds, voting, nested comments, moderation, and security. Some route handlers and community subservice wiring were not sampled, so those relationships are omitted or marked unverified.
Main entry points: app.ts Express Application · user.model.ts User Accounts · auth.service.ts Account Services · post.service.ts Feed And Voting
Components 28
API Platform
- Express Application
src/app.ts - Security Middleware
src/middlewares/sanitize.middleware.ts - Request Validation
src/middlewares/validate.middleware.ts - Error Handling
src/middlewares/error.middleware.ts - MongoDB
src/config/db.ts
Identity
- Auth Routes
src/routes/oauth.route.ts - Authentication
src/controllers/auth.controller.ts - Google OAuth
src/controllers/oauth.controller.ts - Account Services
src/services/auth.service.ts - Email Delivery
src/services/mail.service.ts - User Accounts
src/models/user.model.ts
Posts And Comments
- Post Routes
src/routes/post.route.ts - Post Operations
src/controllers/post.controller.ts - Feed And Voting
src/services/post.service.ts - Posts
src/models/post.model.ts - Cloudinary Media
src/services/cloudinary.service.ts - Comment Routes
src/routes/comment.route.ts - Comment Operations
src/controllers/comment.controller.ts - Comment Trees
src/services/comment.service.ts - Comments
src/models/comment.model.ts
Communities
- Community Routes
src/routes/community.route.ts - Community Operations
src/controllers/community.controller.ts - Community Services
src/services/community.service.ts - Communities
src/models/community.model.ts
Discovery
- Search Routes
src/routes/search.route.ts - Search Endpoint
src/controllers/search.controller.ts - Unified Search
src/services/search.service.ts
Other components
- HTTP Client
Connections 29
- HTTP Client → Express Application: sends requests
- Express Application → Security Middleware: applies sanitization
src/app.ts - Express Application → Auth Routes: mounts
src/app.ts - Express Application → Post Routes: mounts
src/app.ts - Express Application → Comment Routes: mounts
src/app.ts - Express Application → Community Routes: mounts
src/app.ts - Express Application → Search Routes: mounts
src/app.ts - Express Application → Error Handling: handles errors
src/app.ts - Auth Routes → Google OAuth: routes to
src/routes/oauth.route.ts - Search Routes → Search Endpoint: routes to
src/routes/search.route.ts - Authentication → Account Services: calls
src/controllers/auth.controller.ts - Authentication → Email Delivery: sends mail
src/controllers/auth.controller.ts - Google OAuth → User Accounts: queries
src/controllers/oauth.controller.ts - Account Services → User Accounts: creates accounts
src/services/auth.service.ts - Account Services → Email Delivery
- Post Operations → Feed And Voting: calls
src/controllers/post.controller.ts - Post Operations → Cloudinary Media: uploads media
src/controllers/post.controller.ts - Feed And Voting → Posts: queries
src/services/post.service.ts - Feed And Voting → User Accounts: updates karma
src/services/post.service.ts - Comment Operations → Comment Trees: calls
src/controllers/comment.controller.ts - Comment Trees → Comments: manages trees
src/services/comment.service.ts - Comment Trees → Posts: updates counts
src/services/comment.service.ts - Community Operations → Community Services: calls
src/controllers/community.controller.ts - Community Services → Communities: manages communities
- Community Services → Posts
- Search Routes → Request Validation: validates requests
src/routes/search.route.ts - Search Endpoint → Unified Search: queries
- Unified Search → User Accounts: searches users
src/services/search.service.ts - Unified Search → Communities: searches communities
src/services/search.service.ts