FastAPI project generator with a root-level, Django-style app layout
Project description
fastapi-templatekit
A FastAPI TemplateKit with a root-level, Django-style app layout.
CLI
Create a new project without installing this template into that project's environment:
uvx fastapi-templatekit startproject myproject
cd myproject
uvx fastapi-templatekit startapp users
Create the project files directly in the current directory:
uvx fastapi-templatekit startproject myproject .
If generated files already exist, the CLI asks before overwriting them. Use
--force to overwrite without a prompt:
uvx fastapi-templatekit startproject myproject . --force
Create the project at a custom path:
uvx fastapi-templatekit startproject myproject ../services/myproject
For local development from this repository:
uvx --from . fastapi-templatekit startproject myproject
Generated projects include a Typer management command to discover registered HTTP and websocket routes:
uv run myproject urls
Show available commands and details:
uvx fastapi-templatekit help
Add health probes to an existing generated project:
uvx fastapi-templatekit addhealthprobes
Create an app with optional websocket and database scaffolding:
uvx fastapi-templatekit startapp users
uvx fastapi-templatekit startapp users --with-websockets --with-database
Generated projects keep the main router beside main.py:
myproject/
├── pyproject.toml
├── fastapi_templatekit.toml
├── myproject/
│ ├── __init__.py
│ ├── main.py
│ ├── config.py
│ └── router.py
└── users/
├── __init__.py
├── router.py
├── endpoints/
│ ├── __init__.py
│ └── api.py
├── schemas/
│ ├── __init__.py
│ └── validator.py
├── service/
│ ├── __init__.py
│ └── users_service.py
├── models/ # created only with database/tables enabled
│ └── __init__.py
└── websocket/ # created only with websockets enabled
├── __init__.py
└── router.py
Structure
.
├── api/ # top-level router registration
├── health/ # example domain app at project root
├── main/
│ ├── config.py # settings and config live here
│ └── app.py # FastAPI declaration lives here
└── pyproject.toml
This follows the same domain-first idea from fastapi-best-practices, but without a src/ directory.
Feature apps and the shared API router live directly under the project root, similar to Django apps.
Run
uv run uvicorn main.app:app --reload
WebSockets
WebSocket routes are mounted under the same API prefix, so the default endpoint is:
/api/v1/ws/{room_name}
There is also a built-in browser test page at:
/api/v1/ws/test
This app uses fastapi-websockets with the package's environment-based channel-layer loader.
For websocket-related environment configuration, refer to https://github.com/Amogha-Hegde/fastapi-websockets.
Tests force FASTAPI_WEBSOCKETS_BACKEND=inmemory so they do not depend on a running database.
Example session:
connect ws://127.0.0.1:8000/api/v1/ws/demo
receive {"event":"connected","room":"demo",...}
send {"sender":"alice","message":"hello"}
receive {"event":"message","room":"demo","sender":"alice","message":"hello"}
Add a new app
Create a root-level package such as users/ or orders/, define its router there, and include it from your project's main router.py.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file fastapi_templatekit-0.1.0.tar.gz.
File metadata
- Download URL: fastapi_templatekit-0.1.0.tar.gz
- Upload date:
- Size: 15.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7ebe34e037bf450d8c2a7f678536dd2744205667c055977c144af1304896c518
|
|
| MD5 |
54f348f5fe41a64100851a1c8762c4c3
|
|
| BLAKE2b-256 |
7f58e2f155a4343e3a2672547d7dc29d80ca227147adec4a90699f6ba5cf4fae
|
Provenance
The following attestation bundles were made for fastapi_templatekit-0.1.0.tar.gz:
Publisher:
publish.yml on Amogha-Hegde/fastapi-templatekit
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fastapi_templatekit-0.1.0.tar.gz -
Subject digest:
7ebe34e037bf450d8c2a7f678536dd2744205667c055977c144af1304896c518 - Sigstore transparency entry: 1791746649
- Sigstore integration time:
-
Permalink:
Amogha-Hegde/fastapi-templatekit@a05bcef432897bf55dc1763963f3b466033c8909 -
Branch / Tag:
refs/tags/0.1.0 - Owner: https://github.com/Amogha-Hegde
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@a05bcef432897bf55dc1763963f3b466033c8909 -
Trigger Event:
push
-
Statement type:
File details
Details for the file fastapi_templatekit-0.1.0-py3-none-any.whl.
File metadata
- Download URL: fastapi_templatekit-0.1.0-py3-none-any.whl
- Upload date:
- Size: 22.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e766536a153b0005ce6ec0160158b21fe7c861dc0a97a75d1a74da88e8f36442
|
|
| MD5 |
681b3393e17649a2d16401e4d961ea65
|
|
| BLAKE2b-256 |
d3b49f5721e808166e1cdc42d722c10b513151525e7079105da1cb7251eb7ff1
|
Provenance
The following attestation bundles were made for fastapi_templatekit-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on Amogha-Hegde/fastapi-templatekit
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fastapi_templatekit-0.1.0-py3-none-any.whl -
Subject digest:
e766536a153b0005ce6ec0160158b21fe7c861dc0a97a75d1a74da88e8f36442 - Sigstore transparency entry: 1791746743
- Sigstore integration time:
-
Permalink:
Amogha-Hegde/fastapi-templatekit@a05bcef432897bf55dc1763963f3b466033c8909 -
Branch / Tag:
refs/tags/0.1.0 - Owner: https://github.com/Amogha-Hegde
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@a05bcef432897bf55dc1763963f3b466033c8909 -
Trigger Event:
push
-
Statement type: