A full-stack, cloud-native hospital management system built with Python FastAPI for backend, React.js for frontend, and PostgreSQL for the database, deployed on AWS ECS Fargate with Terraform IaC and CI/CD via GitHub Actions.
Author: Johntoby for Borderless Tech Academy
- Features
- Tech Stack
- Architecture
- Screenshots
- Getting Started
- Local Development
- AWS Deployment
- API Documentation
- Load Testing
- Cost Breakdown
- Contributing
- License
- Patient Management β Register, update, and track patient records
- Doctor Management β Manage doctor profiles and specializations
- Appointment Scheduling β Book, reschedule, and cancel appointments
- Department Management β Organize hospital departments
- Dashboard & Analytics β Real-time statistics and visualizations
- Authentication & Authorization β JWT-based auth with role-based access control
- Auto-Scaling β Handles up to 500 concurrent users on AWS
- Observability β Prometheus metrics, CloudWatch logs and alarms
- Load Testing β Locust-based performance testing suite
| Layer | Technology |
|---|---|
| Frontend | React 18, Vite, Tailwind CSS, React Router, React Query, Recharts |
| Backend | Python 3.x, FastAPI, SQLAlchemy, Pydantic, Alembic |
| Database | PostgreSQL 16 |
| Auth | JWT (python-jose), bcrypt |
| Containerization | Docker, Docker Compose, Nginx |
| Cloud | AWS ECS Fargate, ALB, RDS, ECR, VPC, CloudWatch |
| IaC | Terraform |
| CI/CD | GitHub Actions |
| Load Testing | Locust |
| Monitoring | Prometheus, CloudWatch Alarms |
βββββββββββββββ βββββββββββββββββββββββββββββββββββββββββββββββββββ
β Client β β AWS Cloud β
β (Browser) ββββββββΆβ ALB βββ¬βββΆ ECS Frontend (React/Nginx) β
βββββββββββββββ β β β
β ββββΆ ECS Backend (FastAPI) βββΆ RDS (PG) β
βββββββββββββββββββββββββββββββββββββββββββββββββββ
| Component | Details |
|---|---|
| Compute | ECS Fargate (serverless containers) |
| Database | RDS PostgreSQL 16, Multi-AZ, encrypted |
| Load Balancer | Application Load Balancer with path-based routing |
| Registry | Amazon ECR |
| Networking | VPC with public/private subnets across 2 AZs |
| Monitoring | CloudWatch Logs + Alarms, Prometheus metrics |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
- Docker Desktop 24+
- Git
- (For AWS deployment) AWS CLI v2, Terraform >= 1.10.0
git clone https://github.com/your-username/borderless-hms.git
cd borderless-hms- Create a
.envfile from the example:
cp .env.example .envUpdate for local use:
POSTGRES_SERVER=postgres
POSTGRES_PORT=5432
POSTGRES_USER=postgres
POSTGRES_PASSWORD=H0sp1talDev2024!
POSTGRES_DB=hospital_db
POSTGRES_SSL_MODE=disable
SECRET_KEY=local-dev-secret-key-change-in-production
ENVIRONMENT=development
DEBUG=true
BACKEND_CORS_ORIGINS=["http://localhost:3000","http://localhost:80","http://localhost:8080"]- Start all services:
docker compose up --build- Access the application:
| URL | Description |
|---|---|
| http://localhost:8080 | Full app (via Nginx proxy) |
| http://localhost:8000/api/v1/docs | Swagger API documentation |
- Default login:
| Username | Password | Role |
|---|---|---|
| admin | Admin@12345 | System Administrator |
- Stop services:
docker compose down # keeps data
docker compose down -v # full reset (deletes database)For the full local development guide (pgAdmin, rebuilding, logs), see localdev.md.
The application deploys to AWS ECS Fargate using Terraform. The full step-by-step deployment guide is available in aws-setup.md.
High-level steps:
- Configure AWS CLI
- Create
terraform.tfvarswith your secrets - Deploy ECR repositories
- Build & push Docker images
- Deploy full infrastructure (
terraform apply) - Verify via ALB DNS URL
CI/CD is handled by GitHub Actions β every push to main triggers:
Build β Test β Push to ECR β Deploy to ECS β Verify
The backend exposes a full OpenAPI/Swagger UI at /api/v1/docs.
| Group | Endpoints |
|---|---|
| Auth | POST /api/v1/auth/login, POST /api/v1/auth/register |
| Patients | GET/POST/PUT/DELETE /api/v1/patients |
| Doctors | GET/POST/PUT/DELETE /api/v1/doctors |
| Appointments | GET/POST/PUT/DELETE /api/v1/appointments |
| Stats | GET /api/v1/stats |
| Health | GET /health |
| Metrics | GET /metrics (Prometheus) |
Load tests are written with Locust and located in the load-tests/ directory.
cd load-tests
pip install locust
export LOAD_TEST_USERNAME=admin
export LOAD_TEST_PASSWORD=Admin@12345
locust -f locustfile.py --host=http://localhost:8080Open http://localhost:8089 to configure and start the test.
Production target: 50,000 concurrent users with auto-scaling up to 20 ECS tasks.
| Service | Monthly Cost |
|---|---|
| ECS Fargate (4 tasks) | ~$58 |
| RDS PostgreSQL (db.t3.medium, Multi-AZ) | ~$70 |
| ALB | ~$22 |
| NAT Gateway | ~$10 |
| ECR / CloudWatch / misc | ~$4 |
| Total | ~$164/month |
See aws-setup.md for tips on reducing costs for dev/staging environments.
borderless-hms/
βββ backend/
β βββ app/
β β βββ api/routes/ # FastAPI route handlers
β β βββ core/ # Config, security utilities
β β βββ db/ # Database models, session
β β βββ schemas/ # Pydantic schemas
β β βββ main.py # App entry point
β βββ Dockerfile
β βββ requirements.txt
βββ frontend/
β βββ src/
β β βββ components/ # Reusable UI components
β β βββ context/ # React context providers
β β βββ pages/ # Page components (Dashboard, Patients, etc.)
β β βββ services/ # API service layer (Axios)
β β βββ App.jsx
β β βββ main.jsx
β βββ Dockerfile
β βββ nginx.conf
β βββ package.json
βββ load-tests/
β βββ locustfile.py # Locust load test scenarios
βββ screenshots/ # Application & infrastructure screenshots
βββ .env.example # Environment variable template
βββ nginx-proxy.conf # Local dev reverse proxy config
βββ aws-setup.md # AWS deployment guide
βββ localdev.md # Local development guide
βββ architecture-diagram.png
βββ LICENSE
- Fork the repository
- Create a feature branch (
git checkout -b feature/your-feature) - Commit your changes (
git commit -m 'Add your feature') - Push to the branch (
git push origin feature/your-feature) - Open a Pull Request
This project is licensed under the MIT License β see the LICENSE file for details.
Copyright (c) 2026 John Idowu








