Skip to main content

FastAdmin is an easy-to-use Admin Dashboard App for FastAPI/Flask/Django inspired by Django Admin.

Project description

FastAdmin — Admin Dashboard for FastAPI, Flask and Django

CI codecov PyPI Python 3.12+ License: MIT

FastAdmin is an easy-to-use admin dashboard (admin panel) for FastAPI, Flask and Django, inspired by Django Admin. It gives your Python web application a production-ready CRUD admin interface in minutes — on top of Tortoise ORM, Django ORM, SQLAlchemy, Pony ORM or Yara ORM — with authentication, filters, search, inline editing, file uploads, CSV/JSON export and dashboard charts out of the box.

FastAdmin is built with relationships in mind and admiration for Django Admin. It aims to be minimal, functional and familiar: if you know Django Admin, you already know FastAdmin.

📚 Documentation: https://vsdudakov.github.io/fastadmin/

Demo

FastAdmin demo — admin panel for FastAPI, Flask and Django

Features

  • Familiar Django-Admin-style APIlist_display, list_filter, search_fields, fieldsets, readonly_fields, inlines, actions and more.
  • Any web framework — mount as a FastAPI sub-app, a Flask blueprint or Django urlpatterns.
  • Any ORM — first-class admin classes for Tortoise ORM, Django ORM, SQLAlchemy (async), Pony ORM and Yara ORM (a fast, Rust-engine async ORM).
  • Authentication & permissions — pluggable sign-in against your own user model, per-action permission hooks, request/user context in every admin method.
  • Rich form widgets — 20+ antd-based widgets (rich text, JSON, async select, phone, slug, date/time pickers, switches, radio groups, …) via formfield_overrides.
  • File & image uploads — storage-agnostic upload_file hook and presigned-URL support via get_file_url (local disk, S3, …).
  • Dashboard widgets — declarative line/area/column/bar/pie charts and action widgets with filters, powered by antd charts.
  • Bulk actions & export — custom bulk actions, CSV/JSON export.
  • Quality — fully typed and linted (ruff + ty), 100% backend test coverage, modern React (Vite + antd) frontend bundled with the package — no Node.js needed at install time.

Installation

Install with the extras matching your web framework and ORM (each combination works standalone):

pip install fastadmin[fastapi,django]        # FastAPI with Django ORM
pip install fastadmin[fastapi,tortoise-orm]  # FastAPI with Tortoise ORM
pip install fastadmin[fastapi,pony]          # FastAPI with Pony ORM
pip install fastadmin[fastapi,sqlalchemy]    # FastAPI with SQLAlchemy (includes greenlet)
pip install fastadmin[fastapi,yara-orm]      # FastAPI with Yara ORM
pip install fastadmin[django]                # Django with Django ORM
pip install fastadmin[django,pony]           # Django with Pony ORM
pip install fastadmin[flask,sqlalchemy]      # Flask with SQLAlchemy (includes greenlet)

Note: on zsh (the default macOS shell) quote the extras: pip install 'fastadmin[fastapi,django]'.

Configure the required settings:

export ADMIN_USER_MODEL=User
export ADMIN_USER_MODEL_USERNAME_FIELD=username
export ADMIN_SECRET_KEY=secret_key

Quick start

import bcrypt
from fastapi import FastAPI

from fastadmin import TortoiseModelAdmin, register
from fastadmin import fastapi_app as admin_app

from models import User


@register(User)
class UserAdmin(TortoiseModelAdmin):
    exclude = ("hash_password",)
    list_display = ("id", "username", "is_superuser", "is_active")
    list_display_links = ("id", "username")
    list_filter = ("id", "username", "is_superuser", "is_active")
    search_fields = ("username",)

    async def authenticate(self, username: str, password: str) -> int | None:
        user = await User.filter(username=username, is_superuser=True).first()
        if not user:
            return None
        if not bcrypt.checkpw(password.encode(), user.hash_password.encode()):
            return None
        return user.id

    async def change_password(self, id: int, password: str) -> None:
        user = await User.filter(id=id).first()
        if not user:
            return
        user.hash_password = bcrypt.hashpw(password.encode(), bcrypt.gensalt()).decode()
        await user.save(update_fields=("hash_password",))


app = FastAPI()
app.mount("/admin", admin_app)

Run uvicorn example:app and open http://localhost:8000/admin.

Mounting for the other frameworks:

# Flask
from fastadmin import flask_app as admin_app
app.register_blueprint(admin_app, url_prefix="/admin")

# Django (urls.py)
from fastadmin import get_django_admin_urls as get_admin_urls
urlpatterns = [path("admin/", get_admin_urls())]

Documentation

Full documentation lives at vsdudakov.github.io/fastadmin:

Runnable example apps for every framework/ORM combination are in examples/.

Why FastAdmin?

If you are looking for a Django-Admin-like admin panel for FastAPI, an admin interface for SQLAlchemy, Tortoise ORM or Yara ORM, or a lightweight alternative to building a custom back office, FastAdmin gives you a batteries-included, themeable admin UI without code generation, without tying your app to a specific framework, and without writing a single React component.

Pair it with Yara ORM — our fast, async Python ORM with a Rust engine — for a high-performance FastAPI + admin stack.

Contributing

Contributions are welcome — see the contributing guide. Development uses uv and make: make dev, make lint, make test. See CHANGELOG.md for release history.

If you have questions beyond the documentation, feel free to email us.

License

FastAdmin is released under the MIT License.

Project details


Release history Release notifications | RSS feed

This version

0.7.0

Download files

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

Source Distribution

fastadmin-0.7.0.tar.gz (1.8 MB view details)

Uploaded Source

Built Distribution

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

fastadmin-0.7.0-py3-none-any.whl (1.9 MB view details)

Uploaded Python 3

File details

Details for the file fastadmin-0.7.0.tar.gz.

File metadata

  • Download URL: fastadmin-0.7.0.tar.gz
  • Upload date:
  • Size: 1.8 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for fastadmin-0.7.0.tar.gz
Algorithm Hash digest
SHA256 b860bbd23c6537cf00453fc0854ecaf92342b8556d7bc90ac5f3d5c9f0261b3c
MD5 8821498b02e9b3018384e1fc0af4309e
BLAKE2b-256 f6b6f1d85e56120dd7e7548fb5991dcc77b61d90d20d654baef6c98c43d38383

See more details on using hashes here.

File details

Details for the file fastadmin-0.7.0-py3-none-any.whl.

File metadata

  • Download URL: fastadmin-0.7.0-py3-none-any.whl
  • Upload date:
  • Size: 1.9 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for fastadmin-0.7.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0948aad7cd061d46ef68f063909e00c4aa017c8442ce240a134173158dc00953
MD5 a5b0c51823053be1fe0375abbddab173
BLAKE2b-256 a4e149c5351fc37b7930971ccb921f987528a089b56f73c4cea77c7c9972dd13

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