Skip to content

Choose a level or an example

fastkit init creates a project at one of five levels, from a single main.py to a production layout. fastkit init --template copies one of five example projects instead. This page helps you pick one.

Pick by what you need

You want to Run
Learn FastAPI from one file fastkit init (level hello, the default)
Write a small service or a prototype with settings fastkit init --level single-file
Split the code by layer: routes, CRUD, schemas fastkit init --level layered
Grow an API by business area fastkit init --level domain
Deploy with a database, accounts, CI and Docker fastkit init --level production
See one response envelope for every answer, errors included fastkit init --template fastapi-custom-response
Start with real accounts: access and refresh tokens fastkit init --template fastapi-auth-jwt
Build on SQLModel and Alembic fastkit init --template fastapi-sqlmodel
Expose your API to AI clients as MCP tools fastkit init --template fastapi-mcp
Stream a Claude chat reply with a tool-call loop fastkit init --template fastapi-llm-agent

The levels in detail:

Level Description Template Database question Read first
hello One main.py: 3 endpoints, in-memory data, tests. fastapi-hello No Read main.py from top to bottom: each comment links the FastAPI tutorial page that explains it.
single-file The whole app in one module, with settings and tests. fastapi-single-module (preset single-module) Yes (default: None) Read src/main.py: the settings, the app and its routes in one module.
layered Separate layers: routes, CRUD, schemas, core config. fastapi-default (preset classic-layered) Yes (default: None) Read src/main.py, then src/api/routes/items.py, src/crud/items.py and src/schemas/items.py.
domain One package per domain: router, service, repository. fastapi-domain-starter (preset domain-starter) Yes (default: None) Read src/app/main.py, then src/app/domains/items/: router.py, service.py and repository.py.
production domain plus PostgreSQL, Alembic, JWT, CI and Docker. fastapi-domain-starter (preset domain-starter) Yes (default: PostgreSQL) Read src/app/main.py, then src/app/domains/items/; README.md describes each selected feature.

Start from an example project describes the five examples.

Levels or --template

A level is a starting template plus the choices you make on top of it: a database at every level after hello, and the features of the customise step (Customise features). fastkit writes the code for each choice into the project.

--template copies a template as it is. It takes no database or feature options:

$ fastkit init --template fastapi-default --level layered --project-name orders
╭────────────────── Error ───────────────────╮
│ ❌ Use --template or --level, not both.    │
╰────────────────────────────────────────────╯
$ fastkit init --template fastapi-default --feature authentication=JWT --project-name orders
╭───────────────────────────────── Error ──────────────────────────────────╮
│ ❌ --template copies the template as it is; --feature applies to levels. │
╰──────────────────────────────────────────────────────────────────────────╯

fastkit list-templates lists every template, from the simplest to the most involved. The first four are the templates behind the levels.

What each level adds

These lists come from projects created with fastkit init --level <level> --no-venv -y and no other option.

  • hello: main.py, tests/test_main.py, pyproject.toml, requirements.txt, requirements-dev.txt, README.md and .gitignore. No settings module and no secret.
  • single-file: the app moves to src/main.py, which also holds the settings. It adds .env (with a unique SECRET_KEY) and .env.example, .gitattributes, and tests/conftest.py and tests/test_config.py. From this level on, pyproject.toml holds the pytest and coverage settings, and the dev dependencies include pytest-cov and ruff.
  • layered: one package per layer under src/: api/ (api.py, deps.py, routes/items.py), core/ (config.py, pagination.py, responses.py), crud/items.py and schemas/items.py. The items live in src/mocks/mock_items.json. It adds scripts/ (format.sh, lint.sh, run-server.sh, test.sh) and tests for the items API and its store.
  • domain: the code moves to src/app/. Each business area is a package under src/app/domains/; the example items/ holds router.py, service.py, repository.py, schemas.py and models.py. src/app/api/health.py serves /health, and src/app/db/memory.py keeps the items in memory.
  • production: the domain layout with PostgreSQL (src/app/core/database.py), Alembic (alembic.ini, alembic/, scripts/migrate.sh), JWT accounts (src/app/domains/auth/), a readiness probe (src/app/features/readiness.py), structured logs (src/app/logging_config.py), a Dockerfile, docker-compose.yml, .dockerignore and .github/workflows/test.yml.

Generated projects describes what the projects after hello have in common.

Move up later

fastkit does not convert a project to another level. When you want more structure, create a new project at the next level and move your code into it. The Next steps panel of every level names that command, for example in a hello project:

...
│ 7. When you want more structure, create a project at the next level.         │
│      fastkit init --level single-file                                        │
...

Move to a domain layout and a database walks through one such move.