How kaushalkumar08/prescripto works
Project type and purpose
• This is a full-stack web application (“Prescripto”) for booking doctor appointments, managing prescriptions, and handling payments.
• It provides three user interfaces:
– Public patient frontend
– Admin panel frontend
– Doctor-specific pages (within both frontends via routing and role-based access)
• It exposes a REST API server to support authentication, appointment and prescription CRUD, and payment processing.
File structure
Top-level directories:
• frontend/ ← Patient-facing React app
• admin/ ← Admin/Doctor React app
• backend/ ← Node.js/Express REST API
Key patterns and files:
• frontend/src and admin/src each follow a component/context/pages split → UI layer with React Router and Tailwind CSS
• backend/controllers, backend/models, backend/routes, backend/middleware → MVC-style organization
• backend/config → third-party service configuration (MongoDB, Cloudinary)
• .env files in frontend/admin for client keys; backend uses its own .env in server.js
• Deployment configs: Vite, ESLint, PostCSS, vercel.json (admin)
README for additional insights
• Tech stack is React + Tailwind + Vite on the frontends, Node/Express on the backend, MongoDB as the database.
• Dependencies: Stripe (payments), JWT (authentication), Axios (API calls), Toastify (notifications).
• Features: role-based login (patients, doctors, admins), prescription management, appointment scheduling, secure payments.
a. Main components
• Client side
– Patient Frontend (React)
– Admin/Doctor Frontend (React)
• API Layer
– Express.js server with route files for users, doctors, admins
– Middleware for JWT auth and file uploads (multer)
– Controllers for business logic (appointmentController, userController, etc.)
• Data Layer
– MongoDB database (collections: users, doctors, appointments)
• External services
– Stripe for payments
– Cloudinary for image/storage uploads
b. Relationships and interactions
• API to MongoDB showing read/write flows
• API to Stripe (payment processing) and to Cloudinary (media uploads)
• Authentication flow: login request → JWT issued → JWT passed in subsequent API calls → middleware validation
c. Architectural patterns & design principles
• Three-tier architecture: Presentation (React UIs), Application (Express API), Data (MongoDB)
• MVC within the backend (Models, Controllers, Routes)
• Context API in React for global state (AuthContext, AppContext, DoctorContext)
• Separation of concerns between admin and user features via distinct frontends
• RESTful routing and stateless JWT-based authentication
d. Key technologies/frameworks
• Frontends: React.js, Tailwind CSS, Vite, React Router, Context API
• Backend: Node.js, Express.js, Mongoose (ODM)
• Database: MongoDB
• External: Stripe SDK, Cloudinary SDK, Multer (file upload), JWT