Development Setup Guide - irinkobela/MEDICARD-HMS GitHub Wiki
๐ Development Setup Guide โ MEDICARD-HMS Welcome to the MEDICARD-HMS project! This guide will walk you through setting up your development environment for both the backend and frontend of this doctor-centered Hospital Management System.
๐ฆ Prerequisites Before you begin, ensure the following tools are installed on your machine:
General Tools Git
Python 3.10+
pip and venv (bundled with Python)
Node.js (v18+)
npm (comes with Node.js)
PostgreSQL (v14+)
Docker (optional, for containerized setups)
๐ Getting Started
- Clone the Repository bash Copy Edit git clone https://github.com//MEDICARD-HMS.git cd MEDICARD-HMS ๐ง Backend Setup (Flask + PostgreSQL)
- Set Up Python Environment bash Copy Edit
Create virtual environment
python -m venv venv
Activate virtual environment
source venv/bin/activate # On Windows: venv\Scripts\activate 3. Install Backend Dependencies bash Copy Edit pip install -r requirements.txt Note: Ensure requirements.txt includes Flask, SQLAlchemy, Flask-Migrate, etc.
๐ข Database Setup 4. Create PostgreSQL Database Log in to psql and run:
sql Copy Edit CREATE DATABASE medicard_hms; CREATE USER medicard_user WITH PASSWORD 'your_secure_password'; GRANT ALL PRIVILEGES ON DATABASE medicard_hms TO medicard_user; โ๏ธ Configuration 5. Create and Configure .env Copy the sample file:
bash Copy Edit cp .env.example .env Edit .env with your credentials:
ini Copy Edit SECRET_KEY=your_very_strong_random_secret_key DATABASE_URL=postgresql://medicard_user:your_secure_password@localhost:5432/medicard_hms FLASK_APP=run.py FLASK_ENV=development 6. Run Database Migrations bash Copy Edit flask db upgrade (Use flask db init and flask db migrate -m "Initial" if setting up Flask-Migrate for the first time)
๐งช Running the Backend bash Copy Edit
Make sure virtualenv is active
flask run Your backend should now be running on http://127.0.0.1:5000/
๐ Frontend Setup (React) 7. Navigate to Frontend Directory bash Copy Edit cd frontend 8. Install Dependencies and Start Dev Server bash Copy Edit npm install npm start Frontend will run on http://localhost:3000/
โ Running Tests Backend Tests (using pytest) bash Copy Edit
Ensure test dependencies are installed
pytest Add more test cases in the /tests directory as development progresses.
๐ค Contribution Notes Follow PEP 8 and use type hints where possible.
Use feature branches (git checkout -b feature/your-feature) and submit Pull Requests to main.
Include tests for new features and verify with pytest.
๐ Additional Notes You will need to create the .env.example, requirements.txt, and LICENSE files manually if not already present.
Docker support can be added later for easier setup (e.g., Docker Compose for DB + backend).