A modern FastAPI application with a clean architecture.
fastapi_project/
├── app/
│ ├── __init__.py
│ ├── main.py # FastAPI application entry point
│ ├── core/ # Core functionality and settings
│ │ ├── __init__.py
│ │ └── config.py # Application configuration
│ ├── routers/ # API route handlers
│ │ ├── __init__.py
│ │ ├── users.py # User endpoints
│ │ └── items.py # Item endpoints
│ ├── models/ # Database models
│ ├── schemas/ # Pydantic models
│ └── services/ # Business logic
├── tests/ # Test files
├── requirements.txt # Python dependencies
├── .env.example # Environment variables example
└── README.md
- Create a virtual environment:
conda create -n deepflow_openapi python=3.11 -y
conda activate deepflow_openapi
pip install -r requirements.txt- Install dependencies:
pip install -r requirements.txt- Copy the environment variables:
cp .env.example .env- Run the application:
uvicorn app.main:app --reloadThe API will be available at http://localhost:8000
- Swagger UI:
http://localhost:8000/docs - ReDoc:
http://localhost:8000/redoc
GET /healthCheck- Health check endpoint
To run tests:
pytestMIT