Getting Started
This walks through building a minimal admin panel from scratch: one page, one stat, one table, mounted onto a FastAPI app.
Requirements
- Python 3.14+
- FastAPI
Installation
pip install openadmin-pyor with uv:
uv add openadmin-pyBuild a page
An AdminPage holds the widgets for one page in the navigation. Widgets are added by decorating functions with @page.stat, @page.table, @page.form, and @page.action.
# app/admin/dashboard.py
from openadmin import spec
from openadmin.fastapi import AdminPage
page = AdminPage("Dashboard", icon="layout-dashboard")
@page.stat("Total Users")
async def total_users() -> spec.Stat:
return 1_024
@page.table("Recent Users")
async def recent_users() -> spec.Table:
return {
"data": [
{"id": 1, "name": "Alice", "role": "admin"},
{"id": 2, "name": "Bob", "role": "viewer"},
]
}Each decorated function is a normal async def (or sync def) handler — it can take Query/Body parameters, use Depends(...) for a database session, and return whatever your return type declares. The decorator infers the parameter schema from the function signature the same way FastAPI does.
Assemble the panel
AdminPanel is the top-level object. Pages are grouped into named sections:
# app/admin/panel.py
from openadmin.fastapi import AdminPanel
from .dashboard import page as dashboard_page
admin = AdminPanel("My Admin", description="Internal operations panel")
admin.section("General", icon="layout-grid", pages=[dashboard_page])Mount it on your app
AdminPanel.app is a real FastAPI() instance, so it mounts like any sub-application:
# app/main.py
from fastapi import FastAPI
from .admin.panel import admin
app = FastAPI()
app.mount("/admin", admin.app)Run it
fastapi dev app/main.pyVisit http://localhost:8000/admin/ for the UI, or http://localhost:8000/admin/api/openadmin.json to see the raw spec that drives it.
TIP
The panel is unprotected by default — anyone who can reach /admin can view and act on every widget. See Authentication before deploying anywhere reachable by untrusted users.
Next steps
- Components — every widget type, with its full option list.
- Authentication — add a login screen.
- Cookbook — worked recipes for common patterns like reference fields and row actions.