A NestJS-inspired, batteries-included web framework for Python, built on top of FastAPI.
Project description
A NestJS-style, batteries-included web framework for Python, built on top of FastAPI.
Austial
Austial gives Python the exact developer experience of NestJS:
decorator-driven modules/controllers/providers, real constructor-based
dependency injection, the full request lifecycle (guards, pipes,
interceptors, exception filters, middleware), a config layer, a database
layer, Terminus-style health checks, a testing module -- and a CLI so you can
scaffold new projects and artifacts the same way nest new/nest generate do.
This repository (austial-py) is the framework itself -- an installable
library, no bundled sample app. To see it in action, scaffold a new project
with the CLI (see Quickstart below); that generated project is
the "hello world" app, kept separate from the framework's own source tree.
Why
FastAPI is a fantastic ASGI toolkit, but it doesn't prescribe an application architecture. Austial is opinionated on top of FastAPI the way Nest is opinionated on top of Express/Fastify: modules own controllers and providers, providers get dependency-injected by type, and the request pipeline (guard → pipe → interceptor → handler → filter) is a first-class concept instead of something you hand-roll with dependencies everywhere.
Architecture at a glance
| NestJS | Austial |
|---|---|
@Module() |
@Module(imports=, controllers=, providers=, exports=) |
@Controller() / @Get() etc. |
@Controller(prefix) / @Get/@Post/@Put/@Patch/@Delete/@Options/@Head |
@Injectable() |
@Injectable(scope=Scope.DEFAULT | Scope.TRANSIENT) |
| Constructor DI | Container resolves __init__ type hints recursively, singleton by default |
NestFactory.create(AppModule) |
AustialFactory.create(AppModule) -> AustialApplication |
app.listen(3000) |
await app.listen(8000) |
CanActivate / @UseGuards |
CanActivate ABC + ExecutionContext, @UseGuards(...) |
NestInterceptor / @UseInterceptors |
NestInterceptor ABC (intercept(context, call_next)) + @UseInterceptors(...) |
PipeTransform / ValidationPipe |
PipeTransform ABC + ValidationPipe |
ExceptionFilter / @Catch |
ExceptionFilter ABC + @Catch(...), default AllExceptionsFilter |
NestMiddleware, MiddlewareConsumer |
NestMiddleware ABC, configure(consumer) on modules |
ConfigModule.forRoot() |
ConfigModule.for_root(env_file=".env") / ConfigService |
TypeOrmModule.forRootAsync |
DatabaseModule.for_root_async(use_factory=, inject=) (SQLAlchemy async) |
@nestjs/terminus |
austial.terminus.HealthCheckService + MemoryHealthIndicator, DatabaseHealthIndicator |
@nestjs/testing |
austial.testing.Test.create_testing_module(...).compile() |
nest new / nest generate |
austial new <name> / austial generate|g module|controller|service|resource <name> |
A note on file names
Nest names files with dots (health.controller.ts) because Node resolves
modules by explicit relative path strings. Python's import a.b instead
resolves a as a package and b as a submodule -- a literal file
health.controller.py isn't importable via a normal import statement. So
Austial uses underscore suffixes instead: health_controller.py,
health_service.py, health_module.py, health_dto.py. The directory
layout still mirrors Nest 1:1 -- one folder per feature under
src/modules/.
Quickstart
Austial is published on PyPI -- install the CLI and scaffold a new project:
uv tool install austial # or: pipx install austial / pip install austial
austial new my-app # scaffold a new project
cd my-app
uv sync
cp .env.example .env
uv run austial serve # http://localhost:8000, auto-reload
austial new scaffolds a small health-check "hello world" app --
GET /, GET /health, GET /health/protected, /docs (Swagger UI) -- see
Using the CLI below for the full generator reference.
Developing Austial itself
git clone https://github.com/austial/austial-py
cd austial-py
uv sync --all-extras
uv run pytest
Linting, type-checking & pre-commit hooks
uv run ruff check . # lint
uv run ruff format . # format
uv run mypy austial tests # type-check
uv run pre-commit install --hook-type pre-commit --hook-type pre-push
uv run pre-commit run --all-files # run every hook once, on demand
Once installed, git commit runs formatting/linting/type-checks automatically,
and git push also runs the test suite -- mirroring a typical Nest project's
husky + lint-staged setup. Projects scaffolded with austial new get the same
.pre-commit-config.yaml out of the box.
Using the CLI
austial new scaffolds a brand-new project exactly like nest new:
uv run austial new my-app
cd my-app
uv sync
cp .env.example .env
uv run austial serve
New projects depend on the published
austialpackage from PyPI by default. If you're developing the framework itself, point new projects at your local checkout instead with--link:austial new my-app --link /path/to/austial-py-- this adds an editable[tool.uv.sources]entry souv syncresolvesaustialfrom your local checkout rather than PyPI.
austial generate (alias austial g) adds artifacts to an existing project,
patching src/app_module.py's imports/imports=[...] array automatically --
just like nest g:
uv run austial generate module cats # src/modules/cats/cats_module.py
uv run austial generate controller cats # src/modules/cats/cats_controller.py
uv run austial generate service cats # src/modules/cats/cats_service.py
uv run austial generate resource cats # module + full CRUD controller/service/dto/entity
uv run austial g resource cats # same as above, short alias
Repository layout
austial-py/
├── pyproject.toml # package "austial", console-script entry point
├── LICENSE # MIT
├── assets/ # logo.svg (+ logo-dark.svg for dark mode) / icon.svg / apple-icon.png
├── austial/ # the framework (installable library) -- this *is* the package
│ ├── common/ # decorators, guards, interceptors, pipes, filters,
│ │ # middleware, exceptions, logger
│ ├── core/ # metadata/reflector, DI container, router builder,
│ │ # AustialFactory / AustialApplication
│ ├── config/ # ConfigModule / ConfigService
│ ├── database/ # DatabaseModule (SQLAlchemy async)
│ ├── terminus/ # HealthCheckService + health indicators
│ ├── testing/ # Test.create_testing_module(...)
│ └── cli/ # `austial new` / `generate` / `serve` + templates
└── tests/ # tests for the framework itself -- no sample app needed;
├── unit/ # test modules/controllers are defined inline per test file
└── e2e/
There's deliberately no src/ here -- that's what austial new generates for
your project, kept out of the framework's own repo. Test files use Nest's
*.spec.ts naming convention (*_spec.py here); pyproject.toml's
[tool.pytest.ini_options] is configured to discover them.
Request lifecycle
Every route runs through the same pipeline Nest uses:
guards -> pipes -> interceptors (wrapping) -> handler -> exception filters
from austial import Controller, Get, UseGuards, UseInterceptors
from austial.common.interceptors import TransformInterceptor
from .api_key_guard import ApiKeyGuard
@Controller("cats")
class CatsController:
@Get(":id")
@UseGuards(ApiKeyGuard)
@UseInterceptors(TransformInterceptor())
async def find_one(self, id: int):
...
Note path params use Nest's :id syntax (translated to FastAPI's {id}
under the hood), so route strings read exactly like their Nest counterparts.
Releasing
Pushing a v*.*.* tag triggers .github/workflows/publish.yml,
which re-runs the lint/type-check/test gate, builds the sdist + wheel with
uv build, publishes them to PyPI via
trusted publishing (no API
token stored as a secret), and attaches the built artifacts to a GitHub
release:
# bump the version in pyproject.toml first, then:
git commit -am "Bump to vX.Y.Z"
git tag -a vX.Y.Z -m "vX.Y.Z - ..."
git push origin main
git push origin vX.Y.Z
One-time setup: on PyPI's
publishing settings
for the project, add austial-py's publish.yml workflow (environment
pypi) as a trusted publisher.
License
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 austial-0.1.5.tar.gz.
File metadata
- Download URL: austial-0.1.5.tar.gz
- Upload date:
- Size: 6.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 |
57853512b58498326c33ac8ce416560a8a22144bb3c88e361e5358bb905fe476
|
|
| MD5 |
d85c394887cbfe56002c80c67107aed1
|
|
| BLAKE2b-256 |
d301485f9431bf111d8392693dd66f59aa083f270c11f743a1ba24f8e910317e
|
Provenance
The following attestation bundles were made for austial-0.1.5.tar.gz:
Publisher:
publish.yml on austial/austial-py
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
austial-0.1.5.tar.gz -
Subject digest:
57853512b58498326c33ac8ce416560a8a22144bb3c88e361e5358bb905fe476 - Sigstore transparency entry: 2174084282
- Sigstore integration time:
-
Permalink:
austial/austial-py@3ff4f091aea801ad424d70bfac36c6446def4a79 -
Branch / Tag:
refs/tags/v0.1.5 - Owner: https://github.com/austial
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@3ff4f091aea801ad424d70bfac36c6446def4a79 -
Trigger Event:
push
-
Statement type:
File details
Details for the file austial-0.1.5-py3-none-any.whl.
File metadata
- Download URL: austial-0.1.5-py3-none-any.whl
- Upload date:
- Size: 7.6 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 |
68a749f5f0f3d9175e9a38a661bc35b63926507f72811625b3e7a1f80c6e541b
|
|
| MD5 |
8841671f40f3781d986085cbb395aa4a
|
|
| BLAKE2b-256 |
5da054162ac96743ba984aaa542c586e5afcb5160e2a6a2082ae6a658b375045
|
Provenance
The following attestation bundles were made for austial-0.1.5-py3-none-any.whl:
Publisher:
publish.yml on austial/austial-py
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
austial-0.1.5-py3-none-any.whl -
Subject digest:
68a749f5f0f3d9175e9a38a661bc35b63926507f72811625b3e7a1f80c6e541b - Sigstore transparency entry: 2174084305
- Sigstore integration time:
-
Permalink:
austial/austial-py@3ff4f091aea801ad424d70bfac36c6446def4a79 -
Branch / Tag:
refs/tags/v0.1.5 - Owner: https://github.com/austial
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@3ff4f091aea801ad424d70bfac36c6446def4a79 -
Trigger Event:
push
-
Statement type: