Skip to main content

FastAPI Panel

A modular admin panel for FastAPI.
Register a SQLAlchemy model, get a secure back office.

CI PyPI Python 3.10+ MIT license

The product list, with search, filters, bulk actions and inline editing

If you know ModelAdmin, you already know this library: list_display, search_fields, list_filter, fieldsets, inlines, actions and the rest work the way you expect. There is no frontend build, no Node and no extra service. It's server-rendered pages inside your FastAPI app.

Install

pip install fastapi-panel

Quick start

from fastapi import FastAPI
from fastapi_panel import ModelAdmin, ModelAuth, register, site
from sqlalchemy.ext.asyncio import create_async_engine

from myapp.models import Product, User

engine = create_async_engine("postgresql+asyncpg://...")
app = FastAPI()


@register(Product)
class ProductAdmin(ModelAdmin):
    list_display = ("name", "category", "price", "is_published")
    list_filter = ("is_published", "category")
    search_fields = ("name", "category__name")
    ordering = ("-created_at",)


site.mount(
    app,
    engine=engine,
    auth=ModelAuth(User, superuser_field="is_superuser"),
    secret_key=settings.PANEL_SECRET_KEY,
)

Open /admin, log in, and you have a list page, add and edit forms, delete confirmation, bulk actions, CSV export and a change history. See the getting started guide for creating your first user with python -m fastapi_panel createuser and setting up migrations.

Want to try it first? The example shop runs in one command.

What you get

Change lists Columns, computed columns, sorting, search across relations, sidebar filters, saved filters, date drill-down, pagination, editing in the list
Forms Built from your models, with fieldsets, read-only fields, prefilled slugs, validation hooks, Pydantic schemas, a rich text editor, foreign key autocomplete, many-to-many pickers, and a + button to create a related record on the spot
Files and images Uploads with previews and thumbnails, stored on disk or anywhere else through a small storage class
Import and restore CSV import with a preview before anything is saved, and a Deleted page to restore soft-deleted records
Inlines Tabular and stacked, with add, edit and delete on the parent's page
Actions Your own bulk actions, plus delete with a summary of what cascades, CSV export and "select all across pages"
Accounts and permissions Per model and per action, row-level through get_queryset and has_*_permission, with password reset by email
Audit log Who changed which fields and when, on each record's history and a site-wide Activity page, with old and new values for the fields you choose
Any SQLAlchemy setup Sync and async engines, SQLModel, composite primary keys
Timezones Show and enter times in your site's timezone, while the database stays in UTC
Interface Dark mode, works on a phone, keyboard friendly, no external assets
An order with its items edited inline A product form with fieldsets and a many-to-many picker
The dashboard with recent actions The product list in dark mode
Adding a category in a dialog from the product form A CSV import preview before anything is saved

Security

An admin panel can reach all your data, so these are on by default and have no off switch to forget:

  • CSRF tokens and Origin checks on every POST
  • Signed HttpOnly, SameSite=Lax session cookies, Secure on HTTPS, ended by a password change or by deactivating the user
  • Login throttling, no way to tell a wrong username from a wrong password, scrypt password hashing
  • A strict Content-Security-Policy with no inline scripts or styles, X-Frame-Options: DENY, no-store caching
  • Columns named like password, token or secret stay hidden unless you ask for them, and the audit log stores field names, never values
  • Only fields on the form can be written, and sort and filter parameters are allowlisted
  • Spreadsheet formulas are neutralised in CSV exports
  • Uploads get random names, images are checked against their contents, and files are only served behind login

The panel refuses to start without authentication or with a short secret key. Read the security guide for what's left to you.

Documentation

Roadmap

Translations, two-factor login, and a Redis option for login throttling across workers. Ideas and pull requests are welcome, see CONTRIBUTING.

License

MIT

Metadata

Release files for fastapi-panel 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for fastapi-panel 0.2.0
File Size Uploaded Provenance Actions
fastapi_panel-0.2.0.tar.gz 1.4 MB Without provenance Details for fastapi_panel-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for fastapi-panel 0.2.0
File Interpreter ABI Platform Actions
fastapi_panel-0.2.0-py3-none-any.whl Python 3 none any Details for fastapi_panel-0.2.0-py3-none-any.whl

Total release size: 1.5 MB

Release files / fastapi_panel-0.2.0.tar.gz

Download URL fastapi_panel-0.2.0.tar.gz
Size 1.4 MB
Tags Source
SHA-256 checksum
How to use checksums
16e23f25a8403ef4795b509e2f06ecbce7731420c970b43b339f144c44eb572e
BLAKE2b-256 checksum
How to use checksums
a81b47a183c5e4db5ed036cf1e687c24bf6f6af19f35d408483154ee1a7f17b8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / fastapi_panel-0.2.0-py3-none-any.whl

Download URL fastapi_panel-0.2.0-py3-none-any.whl
Size 82.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e6fe237fc070da8940eedf999bda5ae8f42b00d538f18de62ef16474d8cf15dc
BLAKE2b-256 checksum
How to use checksums
dc23dc49f7a10752fd2fbf5b5aa45106c195ffcacbbddeacf7778fed8d67e217
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for fastapi-panel 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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