π This is a GitHub template repository! Click the "Use this template" button to create a new repository based on this template.
A simple, clean FastAPI template to get you started quickly.
- β¨ FastAPI with automatic API documentation
- βοΈ Environment-based configuration
- π₯ Health check endpoints
- π Ready to run locally or deploy
Click the "Use this template" button on GitHub to create your new repository.
# Clone your new repository
git clone https://github.com/yourusername/your-new-project.git
cd your-new-project
# Create virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install dependencies
pip install -r requirements.txt
# Copy environment file
cp .env.example .envEdit .env file:
API_TITLE=Your App Name
API_VERSION=1.0.0
DEBUG=True# Start the server
python main.py
# Or using uvicorn directly
uvicorn main:app --reloadVisit http://localhost:8000 to see your API running!
- Swagger UI: http://localhost:8000/docs
- ReDoc: http://localhost:8000/redoc
GET /- Root endpoint with app infoGET /api/v1/health- Basic health checkGET /api/v1/health/detailed- Detailed health check
βββ api/
β βββ routes/
β βββ health.py # Health check routes
βββ core/
β βββ config.py # App configuration
βββ main.py # FastAPI application
βββ requirements.txt # Python dependencies
βββ .env.example # Environment variables template
- Create a new router file in
api/routes/ - Import and include it in
main.py:
from api.routes.your_new_route import router as your_router
app.include_router(your_router, prefix="/api/v1")Edit core/config.py to change default values or add new configuration options.
Add new packages to requirements.txt and run:
pip install -r requirements.txtAdd new environment variables to .env.example and update core/config.py.
pip install -r requirements.txt
python main.pypip install gunicorn
gunicorn main:app -w 4 -k uvicorn.workers.UvicornWorkerThis project is licensed under the MIT License - see the LICENSE file for details.
Happy coding! π