Skip to main content

A FastAPI package with CRUD endpoints and a Vue + AG Grid frontend for SQLAlchemy models.

Project description

fastapi_agmin

fastapi_agmin is an open-source Python package that provides an autogenerated admin interface for SQLAlchemy models.
It delivers an interactive, in-table CRUD experience using FastAPI + Vue 3 + AG Grid, a CRUD Admin interface for FastAPI SQLAlchemy backed models.

Using it should be as simple as:

from fastapi import FastAPI
from fastapi_agmin import create_agmin

# SQLAlchemy setup
Base = declarative_base()
engine = create_engine("sqlite:///test.db")
SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine)

# Dependency for FastAPI: yields a session and always closes it
def get_db() -> Generator:
    db = SessionLocal()
    try:
        yield db
    finally:
        db.close()

app = FastAPI()
# BELOW IS THE PART THAT MATTERS
create_agmin(Base, get_session=get_db, app=app_test)  # your Base, app, and session here

Then just start your server with uvicorn as normally and access localhost:8000/agmin (if running a local server).

Setup for development

  1. Install backend dependencies
pip install uv  # in case it is not installed
uv venv
uv pip install '.[dev]'
  1. Build frontend
cd frontend
npm install
npm run build

or, if you prefer serving the frontend separately for quicker iteration

cd frontend
npm install
npm run dev

but remeber to build before commiting, because the project is designed to be served by fastapi without an extra frontend server.

  1. Run fastapi test app
uvicorn tests.fastapi_agmin.app_test:app_test --reload --log-level debug

Project Goal

Build a plug-and-play admin interface that:

  • Works with any project using SQLAlchemy models.
  • Automatically exposes CRUD endpoints without manual wiring.
  • Provides a rich, interactive web interface with inline edits, add/remove, and relationship handling.
  • Ships as a single Python package with html and Vue built assets builtin.

🐍 Python Backend Responsibilities

The backend is powered by FastAPI and provides:

✅ A create_agmin function you can import use with your SQLAlchemy Base.
✅ Automatic model introspection (fields, relationships, many-to-many).
✅ A JSON/YAML metadata endpoint at /models/metadata that describes the models + relationships.
✅ Standardized CRUD API endpoints:

  • GET /models/{model}
  • POST /models/{model}
  • PUT /models/{model}/{id}
  • DELETE /models/{model}/{id}

✅ A FastAPI router that serves the prebuilt Vue app at /admin.

Everything is bundled — no extra setup on the Python side.


🌐 Vue 3 Frontend Responsibilities

The frontend (under frontend/) is a standalone TypeScript + Vue 3 app that:

✅ Dynamically loads the backend's model metadata.
✅ Renders AG Grid tables for each model with:

  • Editable cells.
  • Add/delete row buttons.
  • Support for many-to-many and foreign key relationships.

✅ Talks to the backend only over REST APIs using Axios. ✅ Builds into static assets (HTML, JS, CSS) using Vite. ✅ Outputs to src/fastapi_agmin/static/ for Python to serve.

Work to be done

  1. Pagination and pushed down columns filters: the agmin can handle small databases now. To handle big ones, we need to paginate results fetched from the backend. If we do so, column level filters need to be pushed to the API, otherwise they will only filter the results in the current page.
  2. Add Column names and Modal Form fields comming from backend defined names. The same for help text and alike.
  3. Add support for non-integer id/pk columns

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_agmin-0.3.0.tar.gz (8.1 MB view details)

Uploaded Source

Built Distribution

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

fastapi_agmin-0.3.0-py3-none-any.whl (8.0 MB view details)

Uploaded Python 3

File details

Details for the file fastapi_agmin-0.3.0.tar.gz.

File metadata

  • Download URL: fastapi_agmin-0.3.0.tar.gz
  • Upload date:
  • Size: 8.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.5.7

File hashes

Hashes for fastapi_agmin-0.3.0.tar.gz
Algorithm Hash digest
SHA256 a39218a5673158ebd97dc08c42f61f5b70321b5654eadc9c1640e4f8af410dab
MD5 8cd2721f9197fa56f02b4a72d498d749
BLAKE2b-256 e142046c6a38cdd706b82d8ec7316672a7cc89b414552d98628a9f8e45371960

See more details on using hashes here.

File details

Details for the file fastapi_agmin-0.3.0-py3-none-any.whl.

File metadata

File hashes

Hashes for fastapi_agmin-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f5c4aeffcd38249b03c2f72e56f12beaad5ade5bff4ec779c07bc86f52215a9e
MD5 ec53bb9aca8e381cd84e99e7340fb05d
BLAKE2b-256 39c6db0ff250b6278ba831a98747c8392ffde66a951c848e45a217ed98bb73ee

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