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.

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.2.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.2.0-py3-none-any.whl (8.0 MB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: fastapi_agmin-0.2.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.2.0.tar.gz
Algorithm Hash digest
SHA256 af215ff8c2524f44389a21509b1f7c3976b6636c1d7f498891b836909bd460d7
MD5 ac8e444aef27d787d963efc8933b48b5
BLAKE2b-256 754ffda25734f27433eeea4081b41a664441c73a55893f7bdc5619be56995a7c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for fastapi_agmin-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6932240811475265aa2370d439e232a4cb71d553e5a4624eb9c4366fa17d8be4
MD5 9b85ccd577c83a2bbd150467bcd4d2ee
BLAKE2b-256 f512f8fc9dfeafa2b78be50096481a443cc581025a564fd59d63d22c44fcbdc8

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