A FastAPI starter project with user management features, containerized using Docker in two distinct setups. One version uses the traditional requirements.txt with pip, while the other leverages the modern uv package manager for faster and more reproducible Python dependency management.
- FastAPI backend with user management endpoints
- SQLite database integration
- CORS middleware enabled
- Docker containerization
- Health checks for both services
- Docker
- Docker Compose
- Clone the repository:
git clone <repository-url>
cd fastapi-docker-uv-vs-requirements-file- Create a
.envfile:
cp .env.sample .envThen edit the .env file with your configuration values.
- Start the services:
docker-compose up --buildThe services will be available at:
- Requirements file version: http://localhost:8081
- UV version: http://localhost:8082
.
├── core/ # Core functionality
├── models/ # Database models
├── routers/ # API routes
├── Dockerfile.uv # Dockerfile using uv
├── Dockerfile.requirementsfile # Dockerfile using requirements.txt
├── docker-compose.yml # Docker Compose configuration
├── main.py # FastAPI application entry point
├── requirements.txt # Python dependencies
├── pyproject.toml # Project metadata
├── .env.sample # Sample environment variables
└── .env # Environment variables (create from .env.sample)
The project demonstrates two different approaches to Python dependency management:
-
Requirements File Approach:
- Uses traditional
requirements.txt - Installs dependencies using pip
- Port: 8081
- Uses traditional
-
UV Approach:
- Uses modern
uvpackage manager - Faster dependency resolution
- Better caching
- Port: 8082
- Uses modern
Contributions are welcome! Please feel free to submit a Pull Request.
This template is licensed under the MIT License - see the LICENSE file for details.