BookMyDoc A medical appointment booking application with separate frontend, admin panel and backend APIs. This repository contains three projects in the same workspace:
frontend/ – Public website (React + Vite + Tailwind) admin/ – Admin dashboard (React + Vite + Tailwind) backend/ – API server (Express, MongoDB, Cloudinary) This README explains how to run the project locally, required environment variables, and where to find important files.
Table of Contents Features Repo structure Prerequisites Environment variables Run locally API overview Notes and tips Contributing License Features Public-facing booking UI (frontend) Admin dashboard to add/manage doctors (admin) REST API with user auth and doctor management (backend) Image uploads via Cloudinary Repo structure Top-level folders:
frontend/ – public site (Vite + React) admin/ – admin dashboard (Vite + React) backend/ – Express API server Important backend files:
backend/server.js – express entry point backend/config/mongodb.js – MongoDB connection backend/config/cloudinary.js – Cloudinary config backend/controllers/ – API controllers (admin, doctor, user) backend/routes/ – Express routes Prerequisites Node.js (18+ recommended) npm (or pnpm/yarn) MongoDB instance (local or cloud) Cloudinary account (for image uploads) Environment variables Create a .env file at the backend/ folder root with at least the following keys:
MONGODB_URI=mongodb://localhost:27017 CLOUDINARY_NAME=your_cloud_name CLOUDINARY_API_KEY=your_api_key CLOUDINARY_SECRET_KEY=your_api_secret JWT_SECRET=some_long_random_secret ADMIN_EMAIL=admin@example.com ADMIN_PASSWORD=supersecretpassword PORT=4000 MONGODB_URI – MongoDB connection string (the code appends /BookMyDoc on connect) CLOUDINARY_* – Cloudinary credentials used for doctor image uploads JWT_SECRET – used to sign authentication tokens ADMIN_EMAIL / ADMIN_PASSWORD – credentials used by the admin login controller PORT – optional, defaults to 4000 Important: do not commit .env to source control.
Run locally Open three terminals (one per project) or run them sequentially.
Backend
cd backend npm install
npm run server # uses nodemon and will restart on changes The backend listens on the port defined in your .env (default 4000). Visit http://localhost:4000/ to verify the server is running.
Frontend (public site) cd frontend npm install npm run dev Vite will start the frontend on a local dev port (usually 5173). Open the printed URL in your browser.
Admin dashboard cd admin npm install npm run dev The admin panel is a separate React app; open the Vite dev URL shown in the terminal.
Build for production Each project has its own build command:
cd frontend npm run build
cd admin npm run build
API overview Backend base URL: http://localhost:/api
Key endpoints (see backend/routes/* for details):
POST /api/admin/login – admin login POST /api/admin/add-doctor – add a doctor (multipart/form-data image) GET /api/admin/all-doctors – list doctors POST /api/user/register – user registration POST /api/user/login – user login Refer to route files for full details of available endpoints and expected request bodies.
Notes and tips Tailwind CSS is used in both frontend and admin projects. If you modify tailwind.config.js or PostCSS, restart the dev server. The backend uploads images to Cloudinary using the cloudinary package. Make sure your CLOUDINARY_* env vars are correct. The MONGODB_URI in .env should point to a running MongoDB instance. The code will append /BookMyDoc when connecting. JWT tokens are signed with JWT_SECRET. Keep this secret secure. Admin authentication in adminController currently compares to ADMIN_EMAIL and ADMIN_PASSWORD in the .env and returns a token. Troubleshooting If the backend fails to connect to MongoDB, verify the MONGODB_URI and that the database is reachable. If image uploads fail, check Cloudinary credentials and network connectivity. If ports are in use, change PORT in backend .env or Vite dev server ports in frontend/admin configs. Contributing If you want to redesign or refactor the UI, please:
Create a new branch: git checkout -b feat/redesign-home Implement changes in frontend/src/ and admin/src/ as needed Run both dev servers and verify functionality Open a PR with a short description and screenshots of UI changes License This repository does not include a license file. Add one if you plan to open-source the project.
If you'd like, I can now:
generate a polished frontend/README.md with run and design details create a small docs/ folder with a design plan and color system implement the first redesign step (e.g., update Header + Footer) Tell me which of the above you'd like me to do next and I'll proceed.