React + TypeScript frontend for the TeleMed Scheduler application.
- Home Page (
/): List all doctors and view available appointment slots - Booking Page (
/booking/:slotId): Book an appointment for a specific slot - Admin Page (
/admin): Create doctors and manage appointment slots
cd frontend
npm installCreate a .env file in the frontend directory (optional):
VITE_API_URL=https://modex-backend-neb9.onrender.comNote:
- If
VITE_API_URLis not set, the frontend will automatically use:https://modex-backend-neb9.onrender.comin production buildshttp://localhost:3000in development mode
- This ensures the frontend works both locally and when deployed
npm run devThe frontend will run on http://localhost:5173
npm run buildThe built files will be in the dist directory.
npm run previewfrontend/
├── src/
│ ├── api/ # API client and types
│ ├── pages/ # Page components
│ ├── App.tsx # Main app component with routing
│ ├── main.tsx # Entry point
│ └── index.css # Global styles
├── index.html
└── vite.config.ts # Vite configuration
- Displays all available doctors
- Click "View Available Slots" to see slots for a doctor
- Click "Book Now" to book an appointment
- Form to enter patient information
- Shows slot details
- Confirms booking on success
- Doctors Tab: Create new doctors and view all doctors
- Slots Tab: Create new appointment slots and view all slots
The frontend uses the API client in src/api/client.ts which connects to the backend API. Make sure the backend is running and accessible at the URL specified in VITE_API_URL.
-
Build the frontend:
npm run build
-
Deploy the
distfolder to your hosting service -
Set environment variable:
VITE_API_URL=https://your-api-url.onrender.com
You can also serve the frontend from the backend Express server by:
- Building the frontend
- Serving the
distfolder as static files from Express - Adding a catch-all route to serve
index.htmlfor client-side routing