A comprehensive, production-ready medical workflow management system with a modern React frontend and FastAPI backend. Built for healthcare professionals to manage patients, resources, appointments, and analytics with enterprise-grade security and performance.
- Python 3.13+
- Node.js (v14 or higher)
- Docker & Docker Compose (recommended)
- SQLite/PostgreSQL
- FastAPI - Modern Python web framework with automatic API docs
- SQLAlchemy - Database ORM with relationship management
- SQLite/PostgreSQL - Database storage with migration support
- JWT Authentication - Secure token-based authentication
- bcrypt - Password hashing and security
- Pydantic - Data validation and serialization
- uvicorn - ASGI server for production deployment
- Docker - Containerization and deployment
- React 18+ - Modern UI framework with hooks
- React Query (@tanstack/react-query) - Server state management
- Chart.js - Advanced data visualization and analytics
- Styled Components - CSS-in-JS styling solution
- Axios - HTTP client for API communication
- React Router - Client-side routing
- Jest & Testing Library - Comprehensive testing suite
- Webpack - Module bundling and optimization
- SQLAlchemy Models - Relational data modeling
- JWT Tokens - Secure API authentication
- Password Hashing - bcrypt security implementation
- CORS Support - Cross-origin resource sharing
- Input Validation - Pydantic schema validation
- Comprehensive Patient Profiles - Demographics, medical history, insurance
- Medical Records - EHR-compliant record keeping with audit trails
- Patient Search & Filtering - Advanced search capabilities
- Document Management - Upload and manage patient documents
- Insurance Verification - Real-time coverage checking
- Medical Equipment Tracking - Availability, maintenance, allocation
- Staff Scheduling - Doctor availability and appointment management
- Inventory Management - Medical supplies and medication tracking
- Room Management - Facility scheduling and utilization
- Real-time Dashboard - Live metrics and KPIs
- Patient Analytics - Demographics, visit patterns, outcomes
- Resource Utilization - Equipment usage, staff efficiency
- Financial Reports - Revenue tracking, billing analytics
- Custom Reports - Exportable data analysis
- JWT-based Authentication - Secure token management
- Role-based Access Control - Fine-grained permissions
- Password Security - bcrypt hashing with salt
- Session Management - Secure user sessions
- API Rate Limiting - Protection against abuse
# Clone the repository
git clone <your-repo-url>
cd mediflow
# Start the entire application with Docker
docker-compose up --buildBackend Setup:
# Navigate to backend
cd backend
# Create virtual environment
python -m venv venv
# Activate virtual environment
# On Windows: venv\Scripts\activate
# On macOS/Linux: source venv/bin/activate
# Install Python dependencies
pip install -r requirements.txt
# Initialize database
python -c "from app.database import init_db; init_db()"
# Start the FastAPI server
uvicorn app.main:app --reload --host 0.0.0.0 --port 8000Frontend Setup:
# In a new terminal, navigate to frontend
cd frontend
# Install dependencies
npm install
# Start React development server
npm startAccess the platform:
- Frontend:
http://localhost:3000 - Backend API:
http://localhost:8000 - API Documentation:
http://localhost:8000/docs
mediflow/
βββ backend/ # FastAPI Backend
β βββ app/ # Main application package
β β βββ api/ # API route handlers
β β β βββ analytics.py # Analytics endpoints
β β β βββ auth.py # Authentication endpoints
β β β βββ patients.py # Patient management endpoints
β β β βββ resources.py # Resource management endpoints
β β β βββ __init__.py
β β βββ core/ # Core configuration and security
β β β βββ config.py # Application configuration
β β β βββ security.py # Security utilities (JWT, password hashing)
β β β βββ __init__.py
β β βββ models/ # SQLAlchemy database models
β β β βββ base.py # Base model class
β β β βββ patient.py # Patient model
β β β βββ outcome.py # Medical outcome model
β β β βββ resource.py # Resource model
β β β βββ analytics.py # Analytics data model
β β β βββ __init__.py
β β βββ schemas/ # Pydantic schemas for validation
β β β βββ patient.py # Patient schemas
β β β βββ outcome.py # Outcome schemas
β β β βββ resource.py # Resource schemas
β β β βββ user.py # User schemas
β β β βββ analytics.py # Analytics schemas
β β β βββ __init__.py
β β βββ database.py # Database configuration and connection
β β βββ main.py # FastAPI application entry point
β β βββ __init__.py
β βββ venv/ # Python virtual environment
β βββ docker-compose.yml # Docker Compose configuration
β βββ Dockerfile # Docker image definition
β βββ init.sql # Database initialization script
β βββ mediflow.db # SQLite database file
β βββ requirements.txt # Python dependencies
βββ frontend/ # React Frontend
β βββ public/ # Static public assets
β βββ src/ # React application source code
β βββ build/ # Production build output
β β βββ static/
β β βββ css/ # Compiled CSS stylesheets
β β βββ js/ # Bundled JavaScript files
β βββ node_modules/ # Project dependencies (auto-generated)
β βββ package.json # Project configuration and dependencies
βββ README.md # Project documentation
POST /api/auth/login- User login with JWT tokenPOST /api/auth/register- New user registrationPOST /api/auth/refresh- Refresh access tokenPOST /api/auth/logout- Secure logout
GET /api/patients- List all patients with paginationPOST /api/patients- Create new patient recordGET /api/patients/{id}- Get detailed patient informationPUT /api/patients/{id}- Update patient detailsDELETE /api/patients/{id}- Archive patient recordGET /api/patients/{id}/history- Patient medical history
GET /api/resources- List medical resourcesPOST /api/resources- Add new resourcePUT /api/resources/{id}- Update resource availabilityGET /api/resources/availability- Check resource availabilityPOST /api/resources/{id}/allocate- Allocate resource
GET /api/analytics/overview- System overview statisticsGET /api/analytics/patient-stats- Patient demographic analyticsGET /api/analytics/resource-usage- Resource utilization metricsGET /api/analytics/financial- Revenue and billing reports
# Build and start all services
docker-compose -f docker-compose.prod.yml up --build -d
# View logs
docker-compose logs -f
# Scale backend services
docker-compose up --scale backend=3Backend:
# Install dependencies
pip install -r requirements.txt
# Set production environment
export ENVIRONMENT=production
export DATABASE_URL=postgresql://user:pass@localhost/mediflow
# Start with gunicorn
gunicorn app.main:app -w 4 -k uvicorn.workers.UvicornWorkerFrontend:
# Build for production
npm run build
# Serve with nginx or static server
serve -s build -l 3000cd backend
pytest tests/ -vcd frontend
npm test# Backend development server
uvicorn app.main:app --reload
# Frontend development server
npm start
# Run linting
npm run lint
# Build production bundle
npm run build# Backend Configuration
DATABASE_URL=sqlite:///./mediflow.db
SECRET_KEY=your-super-secret-key-here
ALGORITHM=HS256
ACCESS_TOKEN_EXPIRE_MINUTES=30
ENVIRONMENT=development
# Optional: External API Keys
INSURANCE_API_KEY=your-insurance-api-key
LAB_API_KEY=your-lab-integration-keyThe React app automatically connects to the backend API and includes:
- Responsive design for all screen sizes
- Progressive Web App (PWA) capabilities
- Optimized bundle splitting
- Service worker for offline functionality
- Async/Await: FastAPI's asynchronous request handling
- Database Connection Pooling: Efficient database connections
- Caching: Redis integration for frequent queries
- Background Tasks: Celery for heavy operations
- Code Splitting: Automatic bundle optimization
- Lazy Loading: Component-level code splitting
- Memoization: React.memo and useMemo optimizations
- Service Worker: Caching and offline functionality
- HIPAA Compliance - Healthcare data protection standards
- Encryption at Rest - Database encryption for sensitive data
- SSL/TLS - Secure data transmission
- Input Sanitization - Protection against injection attacks
- JWT Authentication - Stateless token-based auth
- Role-based Permissions - Granular access control
- Session Management - Secure user sessions
- Audit Logging - Complete activity tracking
- PostgreSQL Migration - Production database upgrade
- Enhanced API Documentation - Comprehensive Swagger docs
- Unit Test Coverage - 90%+ test coverage
- Real-time Updates - WebSocket integration
- Advanced Analytics - Machine learning insights
- Mobile App - React Native companion app
- Microservices Architecture - Service decomposition
- Advanced Search - Elasticsearch integration
- Backup & Recovery - Automated backup system
- Multi-tenant Support - Multiple facility management
- Two-factor Authentication - Enhanced security
- Data Encryption - End-to-end encryption
- Compliance Auditing - HIPAA audit trails
- Penetration Testing - Regular security assessments
- Fork the repository
- Create a feature branch:
git checkout -b feature/new-feature - Make your changes with proper tests
- Run tests:
npm test(frontend) andpytest(backend) - Commit changes:
git commit -am 'Add new feature' - Push to branch:
git push origin feature/new-feature - Submit a pull request
- Follow PEP 8 for Python code
- Use ESLint and Prettier for JavaScript
- Write tests for new features
- Update documentation for API changes
- Use conventional commit messages
This project is licensed under the MIT License - see the LICENSE file for details.
- Docker Build Failures: Check Docker version and available memory
- API Connection Issues: Verify backend is running on port 8000
- Database Errors: Check database initialization and permissions
- Frontend Build Issues: Clear node_modules and reinstall
Built with β€οΈ for healthcare professionals
Simple, clean, and easy to run - perfect for medical practice management!