Prerequisites
Before installing MediGuide, ensure you have the following installed on your system:Node.js
Version 18.0 or higher required
PostgreSQL
Version 12.0 or higher recommended
You can verify your Node.js version by running
node --version in your terminal.Clone the Repository
First, clone the MediGuide repository to your local machine:Install Dependencies
MediGuide uses npm as its package manager. Install all required dependencies:package.json, including:
- Frontend: React, Vite, Capacitor
- Backend: Express, PostgreSQL driver, JWT, bcrypt
- Validation: Zod schema validator
Database Setup
Create PostgreSQL Database
Create a new PostgreSQL database for MediGuide:Environment Configuration
Create a.env file in the root directory of the project with the following configuration:
.env
For production, use a strong, randomly generated JWT secret. You can generate one using
openssl rand -base64 32.Environment Variables Explained
| Variable | Description | Example |
|---|---|---|
DB_USER | PostgreSQL username | postgres |
DB_HOST | Database host address | localhost |
DB_NAME | Database name | mediguide |
DB_PASSWORD | Database password | Your PostgreSQL password |
DB_PORT | PostgreSQL port | 5432 |
PORT | Backend server port | 3001 |
JWT_SECRET | Secret key for JWT tokens | Min 32 characters |
VITE_API_URL | Frontend API endpoint | http://localhost:3001 |
Mobile Development Configuration
If you’re developing for mobile devices on your local network:.env
192.168.1.X with your actual local IP address.
Initialize the Database
MediGuide automatically creates the required database tables on first run. The initialization script creates:- users table for authentication
- medical_records table for health data
initDb.js
Start the Development Server
MediGuide requires running both the backend API server and the frontend development server.Start Backend Server
In your first terminal, start the Express backend:Start Frontend Development Server
In a second terminal, start the Vite frontend:The Vite dev server includes a proxy configuration that forwards
/api/* requests to the backend server at http://localhost:3001.Verify Installation
Test that everything is working correctly:1. Check Backend Health
2. Open Frontend
Navigate tohttp://localhost:5173 in your browser. You should see the MediGuide login/signup interface.
Build for Production
When you’re ready to build for production:dist directory.
Mobile Development (Optional)
To build for mobile platforms using Capacitor:Sync with Capacitor
Build for Android
Build for iOS
Mobile development requires Android Studio (for Android) or Xcode (for iOS) to be installed.
Troubleshooting
Database Connection Errors
If you see connection errors:- Verify PostgreSQL is running:
sudo systemctl status postgresql - Check your
.envcredentials match your PostgreSQL setup - Ensure the database exists:
psql -U postgres -l
Port Already in Use
If port 3001 or 5173 is already in use:- Change
PORTin.envfor the backend - Vite will automatically try the next available port
JWT Errors
If you see JWT-related errors:- Ensure
JWT_SECRETis set in.env - Use a secret that’s at least 32 characters long
Next Steps
Now that you have MediGuide installed, continue to the Quickstart guide to learn how to use the application and make your first API calls.Quickstart Guide
Learn how to create an account and track your first health metrics