How ijas9118/nexus works
Project Type and Purpose
• Nexus is a full-stack web application for tech-focused blogging, squads (topic groups), real-time chat, video mentorship, and subscription payments.
• The frontend is a React/TypeScript SPA built with Vite, Redux, TanStack Query, Shadcn UI, Tailwind CSS, Socket.IO & WebRTC.
• The backend is a Node.js/Express REST API using Inversify for DI, layered by Controllers → Services → Repositories, persisting data in MongoDB and caching in Redis. It also integrates with Stripe, Cloudinary, SMTP, JWT auth, Socket.IO, WebRTC, and auto-documents via Swagger.
File Structure Analysis
• Top-level: frontend/, backend/, CI/CD workflows, Docker and docker-compose files.
• Frontend: organized by components (atoms → molecules → organisms), features, services, routes, context, store (Redux slices), utils.
• Backend: layered by src/routes → src/controllers → src/services → src/repositories, with shared types, DTOs, DI container, models, middlewares, utils, jobs.
• Infra config: Dockerfiles, Nginx config for FE, CI/CD pipeline.
Key Architectural Patterns
• Frontend: Component-driven UI, client-side routing, centralized state (Redux), query caching, real-time sockets.
• Backend: Repository pattern, dependency injection (Inversify), layered architecture (controllers, services, repositories), REST + WebSocket endpoints, background jobs, third-party integrations.
Main Components
a. User Device / Browser (React SPA)
b. Frontend Server (optional: Nginx container)
c. Backend API Server (Express + Inversify)
d. Real-time Socket Server (Socket.IO)
e. MongoDB (primary datastore)
f. Redis (caching, session management)
g. External Services:
• Stripe (payments)
• Cloudinary (image uploads)
• SMTP/email provider
• Google OAuth
h. WebRTC signaling (could be on backend or separate signaling server)
i. CI/CD pipeline / Docker registry (optional infra layer)
Relationships and Data Flows
• Browser ↔ API Server (REST calls over HTTPS via Axios)
• Browser ↔ Socket.IO Server (WebSocket for chat, notifications)
• Browser ↔ WebRTC peer connections (video calls)
• API Server ↔ MongoDB (CRUD via Mongoose)
• API Server ↔ Redis (cache reads/writes, session store)
• API Server ↔ Stripe API (payment intents, webhooks)
• API Server ↔ Cloudinary API (upload, fetch URLs)
• API Server ↔ SMTP/email (nodemailerTransporter)
• CI/CD ↔ Docker Registry → deploy FE & BE containers