A FastAPI backend for a healthcare application with Supabase as the database.
- User authentication with JWT
- File uploads for avatars and prescriptions using Supabase Storage
- Patient management
- Appointment scheduling
- Prescription management
- AI-assisted diagnosis and medication tools
- Comprehensive error handling
- Docker support
- FastAPI: Modern, fast web framework for building APIs
- Supabase: Open source Firebase alternative (PostgreSQL, Auth, Storage)
- SQLModel: ORM for FastAPI and SQLAlchemy
- Python-Jose: JWT token handling
- Passlib: Password hashing with bcrypt
- Docker: Containerization
healthcare-api/
├── app/
│ ├── AItool/ # AI-assisted tools
│ ├── core/ # Core functionality (config, security, dependencies)
│ ├── db/ # Database connections and ORM
│ ├── demoData/ # Sample data for development
│ ├── models/ # Pydantic and SQLModel models
│ ├── routes/ # API endpoints
│ ├── utils/ # Utility functions
│ └── main.py # Application entry point
├── supabase/
│ └── migrations/ # Database migrations
├── .env.example # Environment variables template
├── Dockerfile # Docker configuration
├── docker-compose.yml # Docker Compose configuration
├── requirements.txt # Python dependencies
└── README.md # Project documentation
- Python 3.8+
- Supabase account
- Docker and Docker Compose (optional)
- Copy the example environment file:
cp .env.example .env- Update the
.envfile with your Supabase credentials and other settings.
docker-compose up -d- Install dependencies:
pip install -r requirements.txt- Run the application:
uvicorn app.main:app --reloadOnce the server is running, you can access the API documentation at:
- Swagger UI: http://localhost:8000/api/docs
- ReDoc: http://localhost:8000/api/redoc
- Create a new Supabase project
- Update your
.envfile with the Supabase URL and anon key - Run the migrations in the
supabase/migrationsdirectory
The API uses JWT tokens for authentication:
- Register a new user:
POST /api/auth/register - Login:
POST /api/auth/login - Use the returned access token in the Authorization header:
Bearer <token>
The API supports file uploads for:
- User avatars:
POST /api/users/me/avatar - Prescription files:
POST /api/prescriptions/{prescription_id}/upload
Files are stored in Supabase Storage buckets.
This project is licensed under the MIT License.