GitHub - rasinmuhammed/opsdeck: The FastAPI-native admin for async SQLAlchemy teams: permissions, row scoping, audit logging, and a modern UI with zero build step

GitHub

3 min read Original article ↗

Live demo → · Docs · Migrating from fastapi-admin?

OpsDeck 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 clean, modern UI by default, with an optional Matrix theme for those who want it
  • Typed Python package metadata for better IDE and AI-assisted integration

Install

Get to a working admin fast

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

from opsdeck import OpsDeck

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

admin = OpsDeck(
    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 opsdeck import OpsDeck, 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 = OpsDeck(
    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, CSV and Excel export
  • Many-to-many relationship handling with multi-select widgets
  • 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
  • Two themes: theme="matrix" (default) and theme="clean" for neutral corporate UIs

Excel export

Excel export requires openpyxl:

pip install opsdeck[excel]
# or
pip install openpyxl

Once installed, an XLSX button appears automatically in the list view alongside the CSV button. No configuration needed.

Why this matters in the age of AI agents

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

  • canonical docs with concise AI-readable summaries
  • llms.txt and llms-full.txt files for agent indexing
  • explicit, predictable integration points
  • focused positioning around FastAPI + async SQLAlchemy
  • migration guidance for developers looking for a maintained fastapi-admin alternative

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

OpsDeck is packaged as a production/stable library. The quality bar is reliability first: scoped data access, explicit permissions, auditability, typed packaging, regression tests, and docs that help both humans and AI coding assistants integrate it correctly.