Skip to main content

Generateur de projet FastAPI async + opinionated (auth JWT, admin UI, ARQ, tests)

Project description

Fabrik logo

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.

PyPI version Python 3.13+ Fabrik CI License: MIT

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 :


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 :

  1. Bumper SCAFFOLD_VERSION dans fabrik/scaffold.py (et version dans pyproject.toml)
  2. Ajouter une fonction patch_vN_to_vM(root) idempotente
  3. L'enregistrer dans PATCHES
  4. fabrik test-self doit 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.

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

fabrik_fastapi-1.0.3.tar.gz (71.4 kB view details)

Uploaded Source

Built Distribution

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

fabrik_fastapi-1.0.3-py3-none-any.whl (58.8 kB view details)

Uploaded Python 3

File details

Details for the file fabrik_fastapi-1.0.3.tar.gz.

File metadata

  • Download URL: fabrik_fastapi-1.0.3.tar.gz
  • Upload date:
  • Size: 71.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.3

File hashes

Hashes for fabrik_fastapi-1.0.3.tar.gz
Algorithm Hash digest
SHA256 4c86b4dabc63ff3e1e62eeb0de6462625bb20dbc974e0e32007db52050ef445d
MD5 701830a38fa7994f42763db1591f660b
BLAKE2b-256 d95d8f6c4f470e8d750bee839a6505e5f7c1e1fe351401977f9050cc1d22244c

See more details on using hashes here.

File details

Details for the file fabrik_fastapi-1.0.3-py3-none-any.whl.

File metadata

  • Download URL: fabrik_fastapi-1.0.3-py3-none-any.whl
  • Upload date:
  • Size: 58.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.3

File hashes

Hashes for fabrik_fastapi-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 39fcb57667b264649df98ab5a625d87f674e52e21af2a736f2b41e94bade0fae
MD5 f9b6fdea0c11408061bd503906a4996f
BLAKE2b-256 c6c0fc1be9248a08ca4f5e2ff6261000b61c9fec07a90c52cba5205b86700ed6

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