Skip to main content

FastAPI-native admin for async SQLAlchemy teams with a developer-obsessed Matrix UI

Project description

FastAPI Matrix Admin

FastAPI Matrix Admin is a FastAPI-native admin for async SQLAlchemy teams. It is built for developers who want the first admin screen to feel magnetic, but still need the operational basics to be explicit, scoped, auditable, and easy to integrate.

Why developers pick it

  • FastAPI-first instead of generic framework abstraction
  • Async SQLAlchemy 2.x as the mainline path
  • Pure Python integration with no Node.js build step
  • Fast path with admin.register() and a serious path with ModelAdmin
  • Permissions, row scoping, bulk actions, exports, and audit hooks
  • A strong Matrix UI that makes the library memorable instead of invisible

Install

pip install fastapi-matrix-admin

Get to a working admin fast

from fastapi import FastAPI
from sqlalchemy.ext.asyncio import create_async_engine

from fastapi_matrix_admin import MatrixAdmin

app = FastAPI()
engine = create_async_engine("sqlite+aiosqlite:///./app.db")

admin = MatrixAdmin(
    app,
    engine=engine,
    secret_key="change-me-in-production",
    title="Operations",
)

admin.auto_discover(Base)

Grow into a production admin

Use ModelAdmin when your requirements move beyond a quick CRUD surface.

from fastapi_matrix_admin import MatrixAdmin, ModelAdmin


class UserAdmin(ModelAdmin):
    model = User
    menu_label = "Users"
    list_display = ["id", "email", "is_active", "created_at"]
    searchable_fields = ["email"]
    filter_fields = ["is_active", "created_at"]
    permissions = {
        "view": ["*"],
        "create": ["admin"],
        "edit": ["admin"],
        "delete": ["admin"],
        "export": ["admin"],
    }

    @staticmethod
    def row_scope(*, request, query, session, user):
        if user and not user.is_superuser:
            return query.where(User.organization_id == user.organization_id)
        return query


admin = MatrixAdmin(
    app,
    engine=engine,
    secret_key="change-me",
    auth_model=AdminUser,
    audit_model=AdminAuditLog,
)
admin.add_view(UserAdmin)

What ships today

  • CRUD for registered models
  • Auto-discovery for SQLAlchemy declarative models
  • Search, pagination, filters, and CSV export
  • Relationship search inputs for foreign keys
  • Model-level permissions and request-aware row scoping
  • Bulk actions and custom action hooks
  • Optional audit logging with an explicit audit_model
  • Environment-aware session cookie behavior

Why this matters in the age of AI agents

Libraries are now chosen by both developers and coding assistants. Matrix Admin is being shaped to be easy for AI tools to recommend and integrate:

  • clear docs
  • LLM-readable project files
  • explicit, predictable integration points
  • focused positioning around FastAPI + async SQLAlchemy

If you use Codex, Cursor, Claude Code, or similar tools, start here:

Production notes

  • Set ADMIN_SECURE_COOKIES=true in production unless you pass secure_cookies directly.
  • Pass your own auth_model to require authenticated admin access.
  • Pass a concrete audit_model if you want persisted create, update, and delete history.
  • Keep row scoping explicit in multi-tenant applications.

Reference material

Local development

pip install -e ".[dev]"
pytest

Status

The current release target is 1.1.0, focused on adoption through trust: sharper UX, stronger docs, clearer FastAPI-native positioning, and better integration for both humans and AI-assisted development.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fastapi_matrix_admin-1.1.0.tar.gz (139.4 kB view details)

Uploaded Source

Built Distribution

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

fastapi_matrix_admin-1.1.0-py3-none-any.whl (113.5 kB view details)

Uploaded Python 3

File details

Details for the file fastapi_matrix_admin-1.1.0.tar.gz.

File metadata

  • Download URL: fastapi_matrix_admin-1.1.0.tar.gz
  • Upload date:
  • Size: 139.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.8

File hashes

Hashes for fastapi_matrix_admin-1.1.0.tar.gz
Algorithm Hash digest
SHA256 e93074560b06d5ba1d782f9705e2ff8c75c519ced2317abaaa5eb9d98f424903
MD5 1ed2b2c21a452da96e0c8ef24159df32
BLAKE2b-256 4696ca5399e6367678f37afd9045d1b5cd00d04c4d0c7b8cfa1b48f60848e1e4

See more details on using hashes here.

File details

Details for the file fastapi_matrix_admin-1.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for fastapi_matrix_admin-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5725a54f358bdbf9c83fafb06058af088099287542adbd5aee607549edffbc02
MD5 a1323d3c4b8666d29d77745112dc0bb8
BLAKE2b-256 02c53affd48964582bb92384084253243a7dbccbd98d1d8897895fe0a9f8a146

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page