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.2.tar.gz (70.5 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.2-py3-none-any.whl (57.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: fabrik_fastapi-1.0.2.tar.gz
  • Upload date:
  • Size: 70.5 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.2.tar.gz
Algorithm Hash digest
SHA256 b4946dcf073b093c85d93085b9a8c4286a020f7e2aeba26ff25d78947773c2d6
MD5 73fe5d7f28c5fc8f427b7657d03fda25
BLAKE2b-256 6d1f060ec02a864a7e713d43cf1f1501053f605bdb93f9d433685074523526ea

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fabrik_fastapi-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 57.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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 e7bfe2fc74905e26a138d3b7c32e0eaf324d3c2d2aa5bc0706ed6229026739f2
MD5 e676e8fdb2ed8769b4af708550c3d072
BLAKE2b-256 110f969f58ff3252e60c9bb34625f852b0902c9c0cff9caa67e54ed008d21041

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