How arihantjain-17/doc-appointment works
Project type and purpose
• This is a full-stack appointment-booking application for doctors and patients.
• The Frontend is a React (Vite) single-page app for users/doctors to browse, sign up/in, view profiles, and schedule appointments.
• The Backend is a Node.js/Express REST API that handles authentication, doctor data, and appointment persistence, with file uploads (via Multer) and a database connection.
File structure
• Top level:
• BackEnd/ – Express app (controllers, routes, models, middleware, config)
• Frontend/ – Vite-powered React app (components, pages, assets, public)
• BackEnd follows an MVC pattern:
• config/ – database.js (DB connection), multer.js (file upload setup)
• models/ – User, appointment, doctordata
• controller/ – business logic (authController, doctorController, appointment)
• rotues/ – REST endpoints (/auth, /doctor, /appointment)
• middleware/ – authMiddleware (JWT checking)
• uploads/ – directory where Multer stores files
• Frontend separation:
• public/index.html, vite.config.js
• src/pages – top-level page components (Login, Signup, Homepage, DoctorProfile, etc.)
• src/components – reusable UI components (Navbar, DocCard, Calendar, TimePicker)
• src/data – placeholder/mock data
• README gives local run instructions (npm run dev in Frontend, node index.js in BackEnd).
a. Client (Browser/SPA)
b. Vite Dev Server (or Static Host in production)
c. Node.js/Express API Server
d. Database (e.g., MongoDB/MySQL – as configured in config/database.js)
e. File Storage (uploads folder on server, or S3 in production)
f. External Services (if any – email/SMS notifications, though not in code now)
Relationships and data flow
• User’s browser loads the React SPA from the Vite server/host.
• SPA sends HTTP(S) requests (GET/POST/PUT/DELETE) to Express endpoints:
• /auth/* for login/signup
• /doctor/* for doctor profiles and data
• /appointment/* for scheduling and fetching appointments
• Express middleware authenticates JWT tokens on protected routes.
• Controllers perform CRUD by calling Models, which interact with the database driver.
• Multer middleware processes file uploads (doctor profile pictures), storing them under uploads/.
• Database persists users, doctors, and appointment records.
Architectural patterns and design principles
• Layered/MVC pattern on the backend (Routes → Middleware → Controllers → Models → DB)
• Component-based architecture on the frontend (Pages → UI Components → Assets)
• Separation of concerns: authentication, business logic, data access, presentation.
• Stateless RESTful API; JWT for stateless auth.