This is a cookiecutter template for FastAPI web service projects.
- Cookiecutter
- FastAPI
- REST API
- Web service
- Microservice
- Project structure
- Boilerplate/template
- Best practices
- Configuration
- Tests
- Build
- Scripts
- Examples
- Documentation
- CI/CD
- Docker and docker compose
- Install Python (>= v3.9) and pip (>= 23):
- [RECOMMENDED] Miniconda (v3)
- [arm64/aarch64] Miniforge (v3)
- [Python virutal environment] venv
For DEVELOPMENT environment:
- Install git
- Setup an SSH key (video tutorial)
2.1. Prepare projects directory (if not exists):
# Create projects directory:
mkdir -pv ~/workspaces/projects
# Enter into projects directory:
cd ~/workspaces/projects2.2. Follow one of the below options [A], [B] or [C]:
OPTION A. Clone the repository:
git clone https://github.com/bybatkhuu/rest.fastapi-template.git && \
cd rest.fastapi-template && \
git checkout cookiecutterOPTION B. Clone the repository (for DEVELOPMENT: git + ssh key):
git clone git@github.com:bybatkhuu/rest.fastapi-template.git && \
cd rest.fastapi-template && \
git checkout cookiecutterOPTION C. Download source code from cookiecutter branch.
# Install cookiecutter:
pip install -U cookiecutter
# Or:
pip install -r ./requirements.txt# Generate project:
cookiecutter -f .
# Or:
./scripts/build.shcd [PROJECT_NAME]
# For example:
cd rest.fastapi-template
# Start:
./compose.sh start -l
# Stop:
./compose.sh stop👍
- Cookiecutter (GitHub) - https://github.com/cookiecutter/cookiecutter
- Cookiecutter (Docs) - https://cookiecutter.readthedocs.io/en/stable
- FastAPI - https://fastapi.tiangolo.com