How aryan9855/curaconnect works
1. Repository shape
- This is a two-app monorepo: Server/ is the backend API and curaConnect/ is the React frontend.
- The system is a classic client/API split with the frontend consuming REST endpoints from the backend.
2. Frontend boundary
- The UI is built with React + Vite, styled with Tailwind CSS, and state-managed with Redux Toolkit.
- Routing is handled in the frontend with page-level views such as Home, About, Catalog, Login/Signup, Dashboard, and Health Program detail/playback pages.
3. Frontend feature organization
- The src/components/core tree is organized by product area: Home page, Auth, Catalog, Dashboard, View Health Program, and About.
- Dashboard functionality is further subdivided into doctor/admin-like flows: creating health programs, editing them, managing enrolled users, cart/payment flow, settings, and profile management.
4. Frontend data layer
- API calls are centralized under src/services, with apiconnector.js, endpoint definitions, and operation modules grouped by domain.
- Redux slices (authSlice, cartSlice, healthProgramSlice, profileSlice, viewHealthProgramSlice) hold the app’s cross-page state, especially auth, enrollment/cart, profile, and active learning/viewing state.
5. Backend architecture
- The server is a Node.js + Express application following an MVC-style structure.
- Request handling is split into routes/, controllers/, middlewares/, models/, and utils/, with Server/index.js acting as the API bootstrap.
6. Backend domain model
- MongoDB models represent the main business entities: User, Profile, OTP, Category, HealthProgram, Section, SubSection, HealthProgramProgress, and RatingAndReview.
- This implies a structured content hierarchy: health programs contain sections and subsections, and users progress through them while leaving ratings/reviews.
7. Authentication and authorization
- Authentication is JWT-based, with auth middleware protecting sensitive routes.
- The presence of profile, password reset, OTP, and email verification models/templates suggests a full account lifecycle: signup, verification, login, profile edits, password reset, and account deletion.
8. Program delivery and enrollment flow
- Users browse health programs, inspect details, enroll, and later view lesson/video content.
- The backend tracks enrollment/progress and sends transactional emails such as verification, enrollment confirmation, payment success, and password updates.
9. Payments and media services
- Payments are integrated through Razorpay, likely for program enrollment checkout and server-side payment verification.
- Media uploads use Cloudinary, which is important for program assets such as thumbnails or other uploaded content.
10. Communication and notifications
- Email delivery is abstracted through utils/mailSender.js plus HTML templates in Server/mail/templates.
- This forms a separate notification boundary from the core API, used for user-facing events like verification, enrollment, and password changes.
11. Key route groups
- Backend routes are grouped by business area: User, Profile, HealthProgram, Payments, and Contact.
- The controllers mirror these route groups, which makes the API split align closely with the domain model.
12. End-to-end data flow
- Typical flow: React page → service module → REST API → controller → MongoDB model/external service → response back to Redux/UI.
- For enrollment/payment flows, the path additionally involves Razorpay verification and email notifications; for media upload flows, Cloudinary sits on the server side before persistence.
13. Deployment and runtime split
- The README indicates separate production deployments for frontend and backend, both hosted on Vercel.
- That means the frontend and API are independently deployable/runtime-separated, even though they form one logical application.
14. What to show in an architecture diagram
- Draw two major boxes: frontend SPA and backend API.
- Inside the backend, emphasize controllers, models, auth middleware, email, Razorpay, and Cloudinary.
- Inside the frontend, emphasize routed pages, dashboard modules, Redux state, and API service layer.
- Connect them through REST calls and show MongoDB as the persistent store plus Razorpay/Cloudinary as external integrations.
Main entry points: Auth.js Controllers · apiconnector.js API services · index.js Redux store · User.js Routes
Components 20
curaConnect SPA
React frontend with routed pages, shared components, Redux state, and API services.
- Marketing pages · Home, About, Catalog, and auth entry pages that drive public navigation.
curaConnect/src/pages/Home.jsx - Dashboard pages · Authenticated views for doctor/admin workflows, settings, profile, cart, and program management.
curaConnect/src/pages/Dashboard.jsx - Learning views · Program detail and playback screens for enrolled health program content.
curaConnect/src/pages/ViewHealthProgram.jsx - Auth UI · Login/signup forms, route guards, dropdowns, and auth templates.
curaConnect/src/components/core/Auth/LoginForm.jsx - Home UI · Landing-page sections, shared navigation/footer, and review/CTA widgets.
curaConnect/src/components/core/HomePage/common/Navbar.jsx - Catalog UI · Program browsing widgets and listing cards/sliders.
curaConnect/src/components/core/Catalog/HealthProgramSlider.jsx - Dashboard modules · Program builder, editing, enrolled programs, doctor views, cart, and settings flows.
curaConnect/src/components/core/Dashboard/AddHealthProgram/index.jsx - Player UI · Video details, sidebar navigation, auto-redirect, and review modal for learning flows.
curaConnect/src/components/core/ViewHealthProgram/VideoDetails.jsx - API services · Centralized REST connector, endpoint catalog, and domain operation modules.
curaConnect/src/services/apiconnector.js - Redux store · App-wide client state composed from feature slices.
curaConnect/src/reducer/index.js - Auth state · Session, identity, and authentication state.
curaConnect/src/slices/authSlice.js - Learning state · Cart, enrolled program, profile, and active viewing state.
curaConnect/src/slices/cartSlice.js
Server API
Express backend with routes, controllers, models, middleware, and service integrations.
- API bootstrap · Server entry point that wires the Express application and runtime configuration.
Server/index.js - Routes · Business-route grouping for user, profile, program, payments, and contact APIs.
Server/routes/User.js - Controllers · Request handlers for auth, profiles, health programs, progress, payments, ratings, sections, and contact.
Server/controllers/Auth.js - Auth middleware · JWT protection for sensitive API routes.
Server/middlewares/auth.js - Domain models · User, profile, OTP, category, program hierarchy, progress, and reviews.
Server/models/User.js - Mail system · Email sender and HTML templates for verification, enrollment, payment, and password updates.
Server/utils/mailSender.js - Media & payments · Cloudinary upload support and Razorpay payment configuration/verification.
Server/config/razorpay.js
External systems
Persistent store and third-party services used by the application.
- MongoDB · Primary database backing users, profiles, programs, progress, and reviews.
Connections 22
- Marketing pages → API services: fetches data · Public pages load catalog, auth, and content data through the client API layer.
- Dashboard pages → API services: mutates data · Dashboard workflows create, edit, enroll, and update records through service modules.
- Learning views → API services: loads playback · Program detail and playback views request content and progress state.
- API services → Redux store: dispatches · Service operations update shared client state after API responses.
- Redux store → Auth state: includes · Store composition includes auth state.
- Redux store → Learning state: includes · Store composition includes cart, profile, and viewing state.
- Auth UI → Auth state: reads/writes · Login and signup flows use auth state and route guards.
- Dashboard modules → Learning state: reads/writes · Program management and enrollment flows use shared learning-related state.
- Home UI → Marketing pages: renders · Shared landing-page components assemble the public pages.
- Catalog UI → Marketing pages: renders · Catalog widgets power the browsing page.
- Player UI → Learning views: renders · Player components assemble the content viewing pages.
- API bootstrap → Routes: mounts · The server entry point wires route groups into the Express app.
- Routes → Controllers: delegates · Routes forward requests to domain controllers.
- Controllers → Auth middleware: protects · Sensitive endpoints rely on JWT middleware.
- Controllers → Domain models: queries · Controllers read and write business entities through models.
- Controllers → Mail system: sends mail · Account, enrollment, and payment events trigger transactional email.
- Controllers → Media & payments: uses · Uploads and payment flows depend on external media/payment services.
- Domain models → MongoDB: persists · Mongoose models store application data in MongoDB.
- Controllers → MongoDB: reads/writes · Controllers ultimately persist and retrieve application data.
- API services → API bootstrap: REST calls · Frontend services call the backend API over REST.
- Routes → Auth middleware: applies · Protected routes are guarded before controller execution.
- Media & payments → MongoDB: confirms state · Payment and upload workflows complete before records are stored or updated.