Skip to content

Start from an example project

Besides the five levels, fastkit ships five example projects. Each one shows a single topic in a working API with tests. fastkit init --template <name> copies one as it is; you cannot add features to it. Each section below says what the example shows, how to create it, which endpoints it serves and what it needs to run. The project's README.md goes into the details.

Template Description Read first
fastapi-custom-response Async Item Management API with Custom Response System Read src/main.py, then src/helper/responses.py and src/api/routes/items.py to see the response envelope.
fastapi-auth-jwt FastAPI JWT Authentication Read src/app/main.py, then src/app/domains/auth/ and src/app/core/security.py.
fastapi-sqlmodel FastAPI SQLModel Read src/app/main.py, then src/app/domains/items/ and src/app/db/session.py; the README explains how to switch to PostgreSQL or MySQL.
fastapi-mcp FastAPI MCP Project Read src/main.py, then src/mcp_server/router.py and src/auth/.
fastapi-llm-agent FastAPI LLM Agent Read src/app/main.py, then src/app/api/chat.py and src/app/llm/agent.py.

The endpoint lists come from the /openapi.json of each project, started with uv run uvicorn right after uv sync. Every example also answers GET /health with {"status":"ok"}, which the tables leave out.

fastapi-custom-response

One response envelope for every JSON answer, errors included: timestamp, status, code, path and message. Exception handlers wrap HTTPException, validation errors and unhandled exceptions in the same envelope. The items live in a JSON file (src/mocks/mock_items.json), read and written asynchronously. It needs no setup beyond uv sync. The request after the table shows a 404 in the envelope.

$ fastkit init --template fastapi-custom-response --project-name items_api
Method Path Summary
GET /api/v1/items List items
POST /api/v1/items Create item
GET /api/v1/items/{item_id} Get item by ID
PUT /api/v1/items/{item_id} Replace item
PATCH /api/v1/items/{item_id} Update item
DELETE /api/v1/items/{item_id} Delete item
$ curl -s http://127.0.0.1:8000/api/v1/items/999
{"timestamp":"2026-12-03T17:26:02.677Z","status":404,"code":"DATA-002","path":"/api/v1/items/999","message":"Item not found"}

fastapi-auth-jwt

Accounts with access and refresh tokens. Refresh tokens rotate on every use, passwords are hashed with Argon2id, and dependencies guard routes by role and by scope. Users are stored with SQLModel; the login, register and refresh endpoints are rate limited.

$ fastkit init --template fastapi-auth-jwt --project-name accounts
Method Path Summary
GET /ready Ready
POST /api/v1/auth/register Register
POST /api/v1/auth/login Login
POST /api/v1/auth/refresh Refresh
POST /api/v1/auth/logout Logout
POST /api/v1/auth/logout-all Logout All
GET /api/v1/users/me Read Current User
PATCH /api/v1/users/me Update Current User
GET /api/v1/users/me/scopes Read Current User Scopes
GET /api/v1/users List Users
GET /api/v1/users/{user_id} Read User

Setup: none for a first run. The app uses a local SQLite file (DATABASE_URL=sqlite:///./app.db in .env), and fastkit wrote .env with a unique SECRET_KEY. The Next steps panel lists uv run alembic upgrade head before the first start. The README shows how to move to PostgreSQL with DATABASE_URL and seed a superuser with FIRST_SUPERUSER_EMAIL and FIRST_SUPERUSER_PASSWORD.

fastapi-sqlmodel

SQLModel over an async engine, Alembic migrations, a generic CRUD base class and paginated list endpoints. One DATABASE_URL selects SQLite, PostgreSQL or MySQL, and the tests stay on SQLite.

$ fastkit init --template fastapi-sqlmodel --project-name notes
Method Path Summary
GET /ready Ready
GET /api/v1/items List Items
POST /api/v1/items Create Item
GET /api/v1/items/{item_id} Read Item
PUT /api/v1/items/{item_id} Replace Item
PATCH /api/v1/items/{item_id} Update Item
DELETE /api/v1/items/{item_id} Delete Item

Setup: SQLite needs no server. Alembic owns the schema (CREATE_TABLES_ON_STARTUP=false in .env), so create the tables after uv sync and before the first start:

$ uv run alembic upgrade head
...
INFO  [alembic.runtime.migration] Running upgrade  -> 0001, create items table
INFO  [alembic.runtime.migration] Running upgrade 0001 -> 0002, store items.created_at with a time zone

For PostgreSQL or MySQL, the README section "Use PostgreSQL or MySQL" starts a local server with the shipped docker-compose.yml (docker compose --profile postgres up -d --wait), installs the driver (uv sync --extra postgresql or --extra mysql) and sets DATABASE_URL in .env.

fastapi-mcp

A FastAPI app whose item endpoints are also MCP (Model Context Protocol) tools: list_items, get_item, create_item, replace_item, update_item and delete_item. Users log in with the OAuth2 password flow. Item reads are public; writes need the owner's token.

$ fastkit init --template fastapi-mcp --project-name mcp_api
Method Path Summary
GET / Root
POST /api/v1/auth/token Get an access token
GET /api/v1/users/me Get the current user
GET /api/v1/users List users (superusers only)
GET /api/v1/items List items
POST /api/v1/items Create an item
GET /api/v1/items/{item_id} Get item by ID
PUT /api/v1/items/{item_id} Replace an item
PATCH /api/v1/items/{item_id} Update some fields of an item
DELETE /api/v1/items/{item_id} Delete an item
GET /api/v1/mcp-server Describe the MCP server

The MCP server is mounted at /mcp and is never open: without credentials it answers 401.

$ curl -s http://127.0.0.1:8000/api/v1/mcp-server
{"enabled":true,"mount_path":"/mcp","title":"FastAPI MCP Server","description":"FastAPI endpoints exposed as MCP tools","tool_tags":["items"]}
$ curl -s -o /dev/null -w '%{http_code}\n' http://127.0.0.1:8000/mcp
401

Setup: the user store is empty until you plug in your own (get_users_db() in src/auth/users.py). For local experiments, ENABLE_DEMO_USERS=true in .env turns on three demo accounts with public passwords (refused outside development). The MCP endpoint takes a user's JWT, or the key you set as MCP_API_KEY in .env; the README section "MCP Authentication" shows both.

fastapi-llm-agent

A Claude chat agent that streams its reply over server-sent events and runs a tool-call loop with two bundled tools (calculator, current_time). Conversations are kept in memory behind an interface you can replace. The tests replace the Anthropic client with a scripted fake, so they need no key and no network.

$ fastkit init --template fastapi-llm-agent --project-name chat_agent
Method Path Summary
POST /api/v1/chat Chat
GET /api/v1/conversations/{conversation_id} Read Conversation
DELETE /api/v1/conversations/{conversation_id} Delete Conversation

Setup: none for the tests and the endpoints; the app starts without a key, and its 88 tests pass with uv run pytest. A real chat needs an Anthropic API key. Set ANTHROPIC_API_KEY in .env (fastkit leaves it empty), then send a message with bash scripts/chat.sh "What is 12 * 34?". To use an Anthropic-compatible gateway instead, set LLM_BASE_URL and, if it uses bearer auth, LLM_AUTH_TOKEN.