Guidance for AI coding agents (Codex, Copilot, Cursor, Zed, OpenCode) working with this repository.
fastapi-fullstack is an interactive CLI tool that generates FastAPI projects with Logfire observability integration. It uses Cookiecutter templates to scaffold complete project structures with configurable options for databases, authentication, background tasks, and various integrations.
# Install dependencies
uv sync
# Run tests
pytest
# Run a single test file
pytest tests/test_cli.py -v
# Linting and formatting (always run before committing)
ruff check . --fix
ruff format .
# Type checking
mypy fastapi_gen# Interactive wizard
fastapi-fullstack new
# Quick project creation
fastapi-fullstack create my_project --database postgresql --auth jwt
# Minimal project (no extras)
fastapi-fullstack create my_project --minimal| Module | Purpose |
|---|---|
cli.py |
Click-based CLI with commands: new, create, templates |
config.py |
Pydantic models for configuration options |
prompts.py |
Interactive prompts using Questionary |
generator.py |
Cookiecutter invocation and messaging |
template/
├── cookiecutter.json # Default context (~75 variables)
├── hooks/post_gen_project.py # Post-generation cleanup
└── {{cookiecutter.project_slug}}/
├── backend/app/ # FastAPI application
└── frontend/ # Next.js 15 (optional)
Template files use Jinja2 conditionals: {% if cookiecutter.use_jwt %}...{% endif %}
- Async-first: All database options except SQLite use async drivers (asyncpg, motor)
- Naming: Project names must match
^[a-z][a-z0-9_]*$ - Package management: Generated projects use UV
- Data access: Repository pattern throughout
- Tests live in
tests/and mirror thefastapi_gen/structure - Use
pytestfixtures fromconftest.pyfor common setup - Template generation tests should use temporary directories
- Run the full test suite before submitting changes
Adding a new CLI option:
- Add the option to
config.py(Pydantic model) - Add the prompt to
prompts.py - Update
cookiecutter.jsonwith the new variable - Add conditional logic to relevant template files
Modifying template output:
- Edit files under
template/{{cookiecutter.project_slug}}/ - Use
{% if cookiecutter.variable %}for conditional content - Test with
fastapi-fullstack create test_project --<relevant-flags> - Check
hooks/post_gen_project.pyif files need conditional deletion
| Resource | Location |
|---|---|
| Template variables | template/cookiecutter.json |
| Post-generation hooks | template/hooks/post_gen_project.py |
| Sprint planning | notes/sprint_0_1_7/ |
| CLI help | fastapi-fullstack --help |