A full-stack MERN (MongoDB, Express, React, Node.js) application for managing patient appointments, treatments, and user authentication at the Aezal Dental Clinic.
- Features
- Tech Stack
- Prerequisites
- Installation
- Environment Variables
- Running Locally
- API Documentation
- Project Structure
- Deployment
- Contributing
- License
- User Authentication: JWT-based signup, login, and role-based access control (admin vs. user).
- Appointment Management: Create, read, update, and delete patient appointments.
- Treatment Management: CRUD operations for dental treatments offered by the clinic.
- Protected Routes: Middleware enforces authentication and authorization for sensitive endpoints.
- Responsive Frontend: React SPA consuming the Express API with client-side routing.
- Frontend: React, React Router, Tailwind CSS
- Backend: Node.js, Express.js, Mongoose
- Database: MongoDB Atlas
- Deployment: Vercel (frontend & serverless backend)
- Node.js (>=14.x)
- npm or yarn
- MongoDB Atlas account (or local MongoDB)
-
Clone the repository
git clone https://github.com/<your-username>/aezal-dental-clinic.git cd aezal-dental-clinic
-
Install dependencies
# Backend cd backend npm install # Frontend cd ../frontend npm install
Create a .env file in the backend/ folder with the following variables:
MONGO_URI=<your-mongodb-connection-string>
JWT_SECRET=<your-jwt-secret>
FRONTEND_URL=http://localhost:3000For production (Vercel), add the same keys in your project settings under Environment Variables.
-
Start the backend server
cd backend npm startThe API will run at
http://localhost:5000. -
Start the frontend
cd frontend npm startThe React app will be available at
http://localhost:3000. -
Proxy setup
The React dev server proxies/apirequests to the backend via theproxyfield infrontend/package.json:{ "proxy": "http://localhost:5000" }
| Method | Endpoint | Description |
|---|---|---|
| POST | /api/users/signup |
Register a new user |
| POST | /api/users/login |
Authenticate and return a token |
| GET | /api/users/me |
Get current user profile (auth) |
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/appointments |
List all appointments (admin only) |
| POST | /api/appointments |
Create a new appointment |
| GET | /api/appointments/:id |
Get appointment by ID |
| PUT | /api/appointments/:id |
Update appointment (owner/admin) |
| DELETE | /api/appointments/:id |
Delete appointment (owner/admin) |
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/treatments |
List all treatments |
| POST | /api/treatments |
Create new treatment (admin only) |
| GET | /api/treatments/:id |
Get treatment by ID |
| PUT | /api/treatments/:id |
Update treatment (admin only) |
| DELETE | /api/treatments/:id |
Delete treatment (admin only) |
This project is configured to deploy both frontend and backend on Vercel:
- Frontend:
@vercel/static-buildreads fromfrontend/build(orfrontend/distif you’re using Vite). - Backend:
@vercel/nodeserves your Express API under/api/*. - Routes in
vercel.json:- Proxy
/api/*to the Express function - Serve static files via Vercel’s CDN
- SPA fallback:
/.*→/index.html
- Proxy
Contributions are welcome! Please open an issue or submit a pull request.
This project is licensed under the MIT License. See the LICENSE file for details.