codex-fastapi-cabinet
Composable, server-rendered administration interfaces for FastAPI sites and APIs.
The library provides the management shell, routing, navigation, generic pages, dashboard widgets, permissions port, Jinja templates, and static assets. Your FastAPI application keeps ownership of authentication, authorization rules, database access, transactions, and business operations.
Status: alpha. The public API is usable, but may evolve before
1.0.
What it provides
- application-scoped admin registry;
- independent mount path, such as
/cabinetor/management; - generic list, detail, form, and operation pages;
- metric, table, list, and chart dashboard widgets;
- async application-owned data providers;
- permission checks for modules, pages, widgets, navigation, and actions;
- overridable Jinja templates and packaged responsive CSS;
- explicit module discovery without import-time registration side effects.
Installation
pip install codex-fastapi-cabinet
For local development:
uv sync --extra dev --extra docs
Quick start
from typing import ClassVar
from fastapi import FastAPI, Request
from fastapi_cabinet import (
CabinetAdmin,
CabinetProvider,
CabinetSite,
ListPage,
ListPageMap,
MetricWidget,
MetricWidgetMap,
SidebarItem,
TableColumnMap,
include_cabinet,
)
async def user_count(request: Request) -> MetricWidgetMap:
return MetricWidgetMap(
key="users-total",
title="Users",
value="42",
subtitle="Registered accounts",
)
async def user_list(request: Request) -> ListPageMap:
return ListPageMap(
title="Users",
columns=[
TableColumnMap(key="email", label="Email"),
TableColumnMap(key="status", label="Status"),
],
rows=[
{
"email": "admin@example.test",
"status": "active",
"href": "/management/users/1",
}
],
row_href_key="href",
)
class UsersAdmin(CabinetAdmin):
key = "users"
label = "Users"
sidebar = (SidebarItem(key="all", label="All users", path="all"),)
dashboard_widgets = (
MetricWidget(key="users-total", title="Users", provider="users.count"),
)
pages = (
ListPage(key="all", label="All users", path="all", provider="users.list"),
)
providers: ClassVar[dict[str, CabinetProvider]] = {
"users.count": user_count,
"users.list": user_list,
}
app = FastAPI()
site = CabinetSite(brand_name="My service")
site.register(UsersAdmin)
include_cabinet(app, site=site, mount_path="/management")
Run the complete example:
uvicorn examples.basic_app:app --reload
Then open http://127.0.0.1:8000/management.
Boundaries
codex-fastapi-cabinet is a composition toolkit, not an ORM-aware CRUD generator. Providers return
validated view models, so the same cabinet can sit over SQLAlchemy, another database layer, an HTTP
API, or an in-memory service without coupling the library to any of them.
The host application must secure the cabinet mount and provide real permission checks. The default permission provider allows every declared permission and is intended only when access control is enforced outside the library.
Documentation
- English documentation
- Русская документация
- Architecture and extension boundaries
- Template customization
Development
ruff check src tests examples
mypy src tests examples
pytest
python -m build
License
Apache License 2.0. See LICENSE.
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 codex_fastapi_cabinet-0.1.0.tar.gz.
File metadata
- Download URL: codex_fastapi_cabinet-0.1.0.tar.gz
- Upload date:
- Size: 30.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c526c11b02e89fac7ad7ee67d63a4bb5307f23ed0b38d9e9390f413b2bec255c
|
|
| MD5 |
e59e41dfb6f01fd73571fa61fe857537
|
|
| BLAKE2b-256 |
6d6dd98aaf0bc8606c41068b5e8388b9e2e7233294528144a2a4adb66412c5c9
|
Provenance
The following attestation bundles were made for codex_fastapi_cabinet-0.1.0.tar.gz:
Publisher:
release.yml on CodexDLC/codex-fastapi-cabinet
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
codex_fastapi_cabinet-0.1.0.tar.gz -
Subject digest:
c526c11b02e89fac7ad7ee67d63a4bb5307f23ed0b38d9e9390f413b2bec255c - Sigstore transparency entry: 2200430127
- Sigstore integration time:
-
Permalink:
CodexDLC/codex-fastapi-cabinet@94b6c2d5e38310ecd5ca04c2fb5e2c08b2b63f15 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/CodexDLC
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@94b6c2d5e38310ecd5ca04c2fb5e2c08b2b63f15 -
Trigger Event:
push
-
Statement type:
File details
Details for the file codex_fastapi_cabinet-0.1.0-py3-none-any.whl.
File metadata
- Download URL: codex_fastapi_cabinet-0.1.0-py3-none-any.whl
- Upload date:
- Size: 32.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
46bad83ed85437fb036f62dc38dc831cc1885bc2880223cb1e195e3058e14514
|
|
| MD5 |
c382f9613196ad93d2bfc02ee28b65ad
|
|
| BLAKE2b-256 |
66f4e6bd5527ac9abed257d84662ce1116df4e753be9055698063298f01d86b0
|
Provenance
The following attestation bundles were made for codex_fastapi_cabinet-0.1.0-py3-none-any.whl:
Publisher:
release.yml on CodexDLC/codex-fastapi-cabinet
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
codex_fastapi_cabinet-0.1.0-py3-none-any.whl -
Subject digest:
46bad83ed85437fb036f62dc38dc831cc1885bc2880223cb1e195e3058e14514 - Sigstore transparency entry: 2200430396
- Sigstore integration time:
-
Permalink:
CodexDLC/codex-fastapi-cabinet@94b6c2d5e38310ecd5ca04c2fb5e2c08b2b63f15 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/CodexDLC
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@94b6c2d5e38310ecd5ca04c2fb5e2c08b2b63f15 -
Trigger Event:
push
-
Statement type: