https://github.com/fernandocelmer/cookiecutter-fastapi
❤️️ Amazing project with FastAPI
https://github.com/fernandocelmer/cookiecutter-fastapi
cookiecutter cookiecutter-fastapi cookiecutter-python cookiecutter-template fastapi fastapi-sqlalchemy fastapi-template pydantic python python-3 python3
Last synced: 3 months ago
JSON representation
❤️️ Amazing project with FastAPI
- Host: GitHub
- URL: https://github.com/fernandocelmer/cookiecutter-fastapi
- Owner: FernandoCelmer
- License: mit
- Created: 2023-11-26T23:53:34.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2024-01-08T03:29:55.000Z (about 2 years ago)
- Last Synced: 2025-03-19T20:49:56.692Z (about 1 year ago)
- Topics: cookiecutter, cookiecutter-fastapi, cookiecutter-python, cookiecutter-template, fastapi, fastapi-sqlalchemy, fastapi-template, pydantic, python, python-3, python3
- Language: Python
- Homepage: https://fernandocelmer.github.io/cookiecutter-fastapi/
- Size: 433 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# cookiecutter-fastapi



- **Documentation**: [https://fernandocelmer.github.io/cookiecutter-fastapi](https://fernandocelmer.github.io/cookiecutter-fastapi)
- **Source Code**: [https://github.com/FernandoCelmer/cookiecutter-fastapi](https://github.com/FernandoCelmer/cookiecutter-fastapi)
## Features
- [x] For FastAPI 0.104.1
- [x] Works with Python 3.12
- [x] Config for MySQL/SQLite
- [x] Docker & Docker Compose
- [x] Async support
- [x] UUID ID type
- [x] Mkdocs
- [x] Basic Auth JWT
- [x] Comprehensive test suite (pytest)
- [x] Templates
- [x] Code quality tools (Ruff, Flake8, MyPy, Black, Isort)
- [x] Pre-commit hooks
- [x] PEP 8 compliance (79 character line length)
- [ ] Crud
## Usage
First install cookiecutter
pip install cookiecutter
Now run this command to clone
cookiecutter https://github.com/FernandoCelmer/cookiecutter-fastapi
Now just fill in some information for the cookiecutter to do its work and replace it in the project.
[1/15] repo_name (cookiecutter-fastapi): cookiecutter-fastapi
[2/15] project_name (FastAPI Template): Test FastAPI
[3/15] project_slug (test_fastapi):
[4/15] description (Amazing project with FastAPI!): Amazing API
[5/15] author_name (Fernando Celmer): Fernando Celmer
[6/15] domain_name (fernandocelmer.com): fernandocelmer.com
[7/15] email (fernando-celmer@fernandocelmer.com): email@fernandocelmer.com
[8/15] version (0.1.0):
[9/15] Select open_source_license
1 - MIT
2 - BSD
3 - Apache Software License 2.0
4 - Not open source
Choose from [1/2/3/4] (1): 1
[10/15] url_documentation (#):
[11/15] url_source_code (#):
[12/15] use_mkdocs (y):
[13/15] use_templates (y):
[14/15] use_auth (y):
[15/15] use_github_workflow (y):
## Development
### Running with Docker
The template includes Docker and Docker Compose configuration for easy development setup.
1. Create a `.env` file based on `.env-exemple`:
```bash
cp .env-exemple .env
```
2. Start the services:
```bash
docker-compose up -d
```
3. The API will be available at `http://localhost:8000`
4. API documentation (Swagger UI) at `http://localhost:8000/docs`
### Running Tests
The template includes a comprehensive test suite using pytest.
1. Install dependencies:
```bash
poetry install
```
2. Run tests:
```bash
pytest
```
3. Run tests with coverage:
```bash
pytest --cov=app --cov-report=html
```
### Code Quality
The template includes comprehensive code quality tools configured with PEP 8 standards (79 character line length).
1. Install code quality dependencies:
```bash
poetry install --with code-quality
```
2. Run code quality checks:
```bash
# Run Ruff (linting and formatting)
poetry run ruff check --config=.code_quality/ruff.toml app/ tests/
poetry run ruff format --check --config=.code_quality/ruff.toml app/ tests/
# Run Flake8
poetry run flake8 --append-config=.code_quality/.flake8 app/ tests/
# Run MyPy (type checking)
poetry run mypy --config-file=.code_quality/mypy.ini app/
```
3. Setup pre-commit hooks:
```bash
poetry run pre-commit install
```
Pre-commit hooks will automatically run code quality checks before each commit.
### Commit Style
- ⚙️ FEATURE
- 📝 PEP8
- 📌 ISSUE
- 🪲 BUG
- 📘 DOCS
- 📦 PyPI
- ❤️️ TEST
- ⬆️ CI/CD
- ⚠️ SECURITY
### License
This project is licensed under the terms of the **MIT** license.