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
- Install backend dependencies
pip install uv # in case it is not installed
uv venv
uv pip install '.[dev]'
- 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.
- 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
- 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.
- Add Column names and Modal Form fields comming from backend defined names. The same for help text and alike.
- 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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file fastapi_agmin-0.4.0.tar.gz.
File metadata
- Download URL: fastapi_agmin-0.4.0.tar.gz
- Upload date:
- Size: 8.1 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.5.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e85a8f7e3a6b4ceaea26503761530cafd9337fbb0eb8354f80020b59eae53eb3
|
|
| MD5 |
22a97d696b24d6d23cec0ad123c12496
|
|
| BLAKE2b-256 |
f3621ca9dab8125384f071be85c98c847c3a05f6b522dede955c6cc5f5ceba35
|
File details
Details for the file fastapi_agmin-0.4.0-py3-none-any.whl.
File metadata
- Download URL: fastapi_agmin-0.4.0-py3-none-any.whl
- Upload date:
- Size: 8.0 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.5.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0c05fe1f495732720ceda81675f877b37abf0b550776efb09d3bee463bb1b69a
|
|
| MD5 |
df8b9a5aa1198a1414dfd454158a554f
|
|
| BLAKE2b-256 |
1b848ce27e8fb4edb9d81389dacb65cec52680b24d39c984ac7cc095a894a569
|