How himanshuiiitbhopal/careayourhealth works
Project Type and Purpose
• Prescripto is a full-stack MERN web application for booking doctor appointments, comprising three user roles (Patient, Doctor, Admin).
• It consists of two React-based frontends (“frontend” for patients, “admin” for doctors & admins) and a Node/Express backend serving REST APIs, persisting data in MongoDB, and integrating with Stripe, Razorpay, and Cloudinary.
High-Level Architecture Components
a. Client Layer
• Patient Portal (frontend/src): React SPA hosted on Vercel, pages for Home, Doctors, Appointment booking, Profile, MyAppointments, Verify, etc.
• Admin/Doctor Portal (admin/src): React SPA with separate routes/pages for Admin (Dashboard, DoctorsList, AddDoctor, AllAppointments) and Doctor (DoctorDashboard, DoctorAppointments, DoctorProfile).
b. API Layer
• Backend Server (backend/server.js): Express.js application exposing REST endpoints under /api/user, /api/doctor, /api/admin.
• Middleware: JWT auth (authUser, authDoctor, authAdmin), file upload via Multer, Cloudinary config for image hosting.
c. Data Layer
• MongoDB (via mongoose in backend/config/mongodb.js) storing User, Doctor, Appointment schemas.
d. External Services
• Stripe & Razorpay for payment processing (configured in controllers).
• Cloudinary for doctor profile image uploads.
• Vercel for frontend & admin deployments (vercel.json configs).
Component Relationships & Data Flows
• Frontends ←–(HTTPS/REST + JWT)–→ Backend API
• Backend API ←–(Mongoose ORM)–→ MongoDB
• Backend API ←–→ Stripe & Razorpay (payment charge creation, webhooks)
• Backend API ←–→ Cloudinary (image upload/download)
Architectural Patterns & Design Principles
• MVC in the backend: Models (in models/), Controllers (in controllers/), Routes (in routes/).
• Context API in frontends for state management (AdminContext, DoctorContext, AppContext, UserContext).
• Separation of concerns: two distinct React apps sharing common patterns (Tailwind CSS, Vite bundler).
• Environment-based configuration (dotenv for API keys, Vercel env).
Technology & Deployment Notes
• Frontends: React, Vite, Tailwind CSS; specify “deployed on Vercel”.
• External payment services: Stripe, Razorpay; Cloudinary.