How rajdeep-samanta59/aura_sphere works
Project Type and Purpose
• From the file tree and README, this is a full-stack web application called “Aura-Sphere” with:
• A Client folder: React (Vite, Tailwind CSS) single-page front end
• A Server folder: Node.js/Express REST API with MVC pattern, authentication, file uploads, and Mongo-style models
• The domain appears to be an educational/gamified platform: users, courses, assignments, challenges, leaderboards, study groups, rewards, events, and virtual rooms.
File Structure
A. Client (React/Vite front end)
• index.html + main.jsx: entry point
• src/component: React components (Landing, Dashboard, GoalsPage, Leaderboard, AuthForm, Navbar, etc.)
• assets + CSS: styling and images
• Tailwind/Vite configs: build and styling pipeline
B. Server (Node.js/Express back end)
• src/index.js: Express app bootstrap
• src/db/connect.js: database connection (likely MongoDB)
• src/models: data schemas for User, Course, Assignment, Challenge, Class, Dept, Doubt, Event, Reward, StudyGroup, Timetable, VirtualRoom
• src/controller: business logic (userController)
• src/routes: route definitions grouped by feature (auth.js, userroute.js, courserouter.js, challengeRoutes.js, leaderboardroute.js, goals.js, etc.)
• src/middleware: auth (Passport JWT?), error handling, file upload (Multer), async handlers
• src/utils: common helpers (ApiError, ApiResponse)
• public/temp: temporary storage for uploaded avatars
• passport.js: authentication strategy
Key Architectural Patterns & Technologies
• Front end: component-based UI, client-side routing (React Router implied), API calls to back end
• Back end: MVC (Model-View-Controller) pattern, layered architecture (routes → controllers → models), middleware pipeline
• Stateless RESTful APIs with JWT via Passport for authentication
• File uploads handled by Multer, stored locally then possibly uploaded to cloud (uploadcloud util)
• MongoDB (or similar document DB) for persistence
Main Components & Interactions
a. Client Application
• React components & UI
• State management (local React state or context)
• HTTP/HTTPS requests to API (Axios/Fetch)
b. API Gateway / Server
• Express server entrypoint
• Middleware chain (auth, error handler, multer)
• Route handlers → Controllers
• Business logic & validation
• Models → Database layer
c. Database
• MongoDB instance or cluster
d. File Storage
• Local temp folder (Server/public/temp)
• External cloud storage (Cloudinary/S3) via uploadcloud util
e. Authentication Service
• Passport JWT strategy → token issuance & verification
f. External Services (optional)
• Email/SMS (if notifications), third-party APIs
Relationships & Data Flow
1. User interacts with React UI
2. UI dispatches API calls (login, fetch courses, upload avatar)
3. Express middleware verifies JWT → routes request
4. Controller executes business logic → reads/writes MongoDB
5. File uploads flow: Front end → Multer middleware → temp storage → uploadcloud util → cloud storage
6. Responses (ApiResponse) returned to client
Important Design Principles
• Separation of concerns: UI vs API vs Data
• Layered MVC on back end: decoupled models, controllers, routes
• Stateless authentication via JWT
• Component-based UI for scalability
• Utility layers (asyncHandler, ApiError) for error consistency