Skip to main content

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 /cabinet or /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

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

codex_fastapi_cabinet-0.1.0.tar.gz (30.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

codex_fastapi_cabinet-0.1.0-py3-none-any.whl (32.7 kB view details)

Uploaded Python 3

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

Hashes for codex_fastapi_cabinet-0.1.0.tar.gz
Algorithm Hash digest
SHA256 c526c11b02e89fac7ad7ee67d63a4bb5307f23ed0b38d9e9390f413b2bec255c
MD5 e59e41dfb6f01fd73571fa61fe857537
BLAKE2b-256 6d6dd98aaf0bc8606c41068b5e8388b9e2e7233294528144a2a4adb66412c5c9

See more details on using hashes here.

Provenance

The following attestation bundles were made for codex_fastapi_cabinet-0.1.0.tar.gz:

Publisher: release.yml on CodexDLC/codex-fastapi-cabinet

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file codex_fastapi_cabinet-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for codex_fastapi_cabinet-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 46bad83ed85437fb036f62dc38dc831cc1885bc2880223cb1e195e3058e14514
MD5 c382f9613196ad93d2bfc02ee28b65ad
BLAKE2b-256 66f4e6bd5527ac9abed257d84662ce1116df4e753be9055698063298f01d86b0

See more details on using hashes here.

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page