Fabrik
Generateur de projet FastAPI async + opinionated.
En 60 secondes : auth JWT, admin UI auto-decouverte, tests isoles,
background tasks (ARQ), migrations Alembic, CORS strict, responsive.
Version : 1.0.1 ·
Auteur : Falandy Jean ·
Licence : MIT
Installation
pip install fabrik-fastapi
Verifier l'installation :
fabrik --help
Pre-requis : Python 3.13+.
60 secondes pour demarrer
fabrik new mon-api
cd mon-api
venv\Scripts\activate # Windows
# source venv/bin/activate # Linux/Mac
python create_superuser.py
python -m uvicorn main:app --reload
Ouvre :
- Admin UI : http://127.0.0.1:8000/admin
- Swagger : http://127.0.0.1:8000/docs
Ce que tu obtiens out-of-the-box
| Domaine | Choix par defaut |
|---|---|
| Framework | FastAPI 0.136 + Starlette |
| ORM | SQLAlchemy 2.0 async (AsyncSession) |
| Driver DB | aiosqlite (dev) / asyncpg (prod PostgreSQL) |
| Auth | JWT (access + refresh) avec bcrypt |
| Admin | UI auto-decouverte responsive, multi-search, bulk delete, CSV |
| Migrations | Alembic (autogenerate) |
| Background tasks | ARQ (Redis-backed, async-native) avec degradation gracieuse |
| Tests | pytest + pytest-asyncio + DB SQLite in-memory isolee |
| CORS | Strict via BACKEND_CORS_ORIGINS (pas de *) |
| Config | pydantic-settings (12-factor) |
| Docker | Dockerfile Python 3.13-slim + docker-compose.yml |
Les 4 commandes
| Commande | Effet |
|---|---|
fabrik new <nom> |
Genere un projet complet (venv + deps + migration initiale) |
fabrik add <module> |
Ajoute un module CRUD (auto-wire + migration + tests) |
fabrik upgrade |
Met a jour un projet existant a la derniere version |
fabrik test-self |
Meta-test : verifie que le scaffold genere un projet OK |
Detail complet dans docs/USAGE.md.
Pourquoi Fabrik ?
Fabrik couvre l'angle mort entre Django (rigide, monolithique, sync) et FastAPI nu (zero opinion, 2 jours de plomberie a chaque projet).
| FastAPI standard | Django | Fabrik | |
|---|---|---|---|
| Stack async | oui | non | oui |
| Auth JWT prete | non | tierce | oui |
| Admin UI auto-genere | non | oui (sync) | oui (async, responsive) |
| Background tasks | non | Celery (tiers) | oui (ARQ inclus) |
| Tests isoles fournis | non | oui | oui |
| Architecture modulaire | a faire | apps | src/<module>/ |
| Migration de projet | non | manuel | fabrik upgrade |
| Demarrage zero-config | 2j | 30 min | 60 secondes |
Detail des choix de conception : ARCHITECTURE.md.
Structure d'un projet genere
mon-api/
├── main.py FastAPI app + lifespan + pool ARQ
├── worker.py Entrypoint ARQ (python worker.py)
├── docker-compose.yml Redis + (PostgreSQL optionnel)
├── .env SECRET_KEY 256 bits + CORS + DB + Redis
├── .scaffold-version Trace de la version Fabrik (pour upgrade)
├── create_superuser.py
├── requirements.txt
├── pytest.ini
├── alembic.ini + alembic/
├── src/
│ ├── database.py AsyncEngine + get_db
│ ├── tasks.py ARQ tasks + WorkerSettings + get_arq dep
│ ├── core/ Config, security, mixins, pagination
│ ├── users/ Module exemple (models/schemas/service/router)
│ └── admin/ UI auto-decouverte (router + templates + static)
└── tests/
├── conftest.py Fixtures async (DB in-memory isolee)
├── test_users.py
└── test_tasks.py
Architecture du repo Fabrik
fabrik/ Repo GitHub
├── pyproject.toml Package metadata (PyPI)
├── MANIFEST.in
├── README.md, ARCHITECTURE.md, LICENSE
├── docs/
│ ├── USAGE.md Guide utilisateur
│ └── PUBLISHING.md Workflow de release PyPI
├── .github/workflows/ci.yml CI : lance test-self a chaque commit
└── fabrik/ Package Python
├── __init__.py
├── __main__.py Pour `python -m fabrik`
├── scaffold.py Moteur CLI
└── core/ Templates copies a chaque `new`
Developpement local
Si tu veux contribuer ou tester en local sans publier sur PyPI :
git clone https://github.com/FalandyJEAN/fabrik.git
cd fabrik
pip install -e . # installation en mode editable
fabrik test-self # verifie que tout fonctionne
Tout changement qui modifie la structure des projets generes doit :
- Bumper
SCAFFOLD_VERSIONdansfabrik/scaffold.py(etversiondanspyproject.toml) - Ajouter une fonction
patch_vN_to_vM(root)idempotente - L'enregistrer dans
PATCHES fabrik test-selfdoit passer en local et en CI
Publication PyPI
Workflow complet dans docs/PUBLISHING.md. En resume :
pip install -e ".[dev]"
python -m build
twine upload dist/*
Licence
MIT © 2026 Falandy Jean — voir LICENSE.
Metadata
Release files for fabrik-fastapi 1.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| fabrik_fastapi-1.0.3.tar.gz | 71.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| fabrik_fastapi-1.0.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 130.2 kB
Release files / fabrik_fastapi-1.0.3.tar.gz
| Download URL | fabrik_fastapi-1.0.3.tar.gz |
|---|---|
| Size | 71.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4c86b4dabc63ff3e1e62eeb0de6462625bb20dbc974e0e32007db52050ef445d
|
|
BLAKE2b-256 checksum How to use checksums |
d95d8f6c4f470e8d750bee839a6505e5f7c1e1fe351401977f9050cc1d22244c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.3
|
Release files / fabrik_fastapi-1.0.3-py3-none-any.whl
| Download URL | fabrik_fastapi-1.0.3-py3-none-any.whl |
|---|---|
| Size | 58.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
39fcb57667b264649df98ab5a625d87f674e52e21af2a736f2b41e94bade0fae
|
|
BLAKE2b-256 checksum How to use checksums |
c6c0fc1be9248a08ca4f5e2ff6261000b61c9fec07a90c52cba5205b86700ed6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.3
|