Clean Architecture scaffolding for Flask (OOP-first)
Project description
Forge CLI
Forge is a command-line tool to scaffold and manage Flask projects with Clean Architecture and strict OOP boundaries. It removes boilerplate, enforces best practices, and provides generators for entities, repositories, services, and controllers — all wired with a minimal DI container.
✨ Features
- 🏗️ Single canonical template: Clean Architecture (domain/app/infra/interfaces/shared)
- 🔒 Strict OOP: no functional boilerplate, clear layering
- 🧩 Generators: add bounded contexts, entities, repos, services, controllers, tests
- 📦 Plugins: OpenAPI (Smorest), JWT auth, telemetry (planned)
- ⚡ DX polish: Ruff + Black + pre-commit, problem+json error model, request IDs, structured logs
- 🗄️ Database support: SQLAlchemy + Alembic migrations
- ✅ Tests: scaffolded per layer (domain/app/infra/http)
- 🔧 CLI utilities: lint, format, db, doctor, tasks (planned)
📦 Installation
From PyPI
pipx install flask-forge-cli
# or
pip install flask-forge-cli
From source (dev mode)
git clone https://github.com/<you>/flask-forge.git
cd flask-forge
pip install -e .
🚀 Quickstart
# create a new clean-architecture Flask project
forge new shop
cd shop
# install dev dependencies
pip install -e ".[dev]"
cp .env.example .env
# init DB
forge db init
forge db migrate -m "init"
forge db upgrade
# run dev server
forge run dev -p 8000
# open http://localhost:8000/health
🧩 Generators
# bounded context
forge generate bc catalog
# entity + repo interface
forge generate entity catalog Product
# repo implementation (SQLAlchemy)
forge generate repo catalog Product --impl=sqlalchemy
# service
forge generate service catalog ProductService
# controller (Flask blueprint)
forge generate controller catalog product
# full resource across layers (+ tests)
forge generate resource catalog Product
🔌 Plugins
forge plugin openapi # add OpenAPI (Smorest + Marshmallow)
forge plugin jwt # add JWT auth endpoints
forge plugin telemetry # (planned) observability hooks
🧑💻 Developer Workflow
# lint (Ruff)
forge lint
# format (Black)
forge format
# check (Ruff + Black)
forge check
# run tests
pytest -q
# check environment
forge doctor all
Enable pre-commit hooks:
pre-commit install
📂 Project Layout (generated app)
src/<pkg>/
app/ # application layer (use cases / services)
domain/ # entities, repositories, value objects
infra/ # db, repo impls
interfaces/ # http controllers, api, middleware
shared/ # config, logging, DI
main.py # thin bootstrap
tests/ # per-layer tests
📜 License
MIT © Kevin Martinez
Project details
Release history Release notifications | RSS feed
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 flask_forge_cli-1.0.1.tar.gz.
File metadata
- Download URL: flask_forge_cli-1.0.1.tar.gz
- Upload date:
- Size: 20.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
264420490d9b12f6d68a144fbe88db706ff613d3e06c799bba88600093c3471e
|
|
| MD5 |
4c306008e04ddd79f5533ca3231ed4e4
|
|
| BLAKE2b-256 |
eced94a61a8489e4e99e19d25bd72e882108e1879e493c4708c7f7326700d166
|
Provenance
The following attestation bundles were made for flask_forge_cli-1.0.1.tar.gz:
Publisher:
release.yml on NastMz/flask-forge
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
flask_forge_cli-1.0.1.tar.gz -
Subject digest:
264420490d9b12f6d68a144fbe88db706ff613d3e06c799bba88600093c3471e - Sigstore transparency entry: 540247257
- Sigstore integration time:
-
Permalink:
NastMz/flask-forge@7d881d87f6c62b70fe0079f624040465d480c7fe -
Branch / Tag:
refs/tags/v1.0.7 - Owner: https://github.com/NastMz
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@7d881d87f6c62b70fe0079f624040465d480c7fe -
Trigger Event:
push
-
Statement type:
File details
Details for the file flask_forge_cli-1.0.1-py3-none-any.whl.
File metadata
- Download URL: flask_forge_cli-1.0.1-py3-none-any.whl
- Upload date:
- Size: 24.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c3c75cebaeffdca30d0cfb1441ac326cd7a4f2be0d0fba29e1fb3df228453eba
|
|
| MD5 |
23d2aa42edaa71404891bc5edd025992
|
|
| BLAKE2b-256 |
20cea848accc6494b321aa3056919c15587bc91255343eb9716d77577ce01f37
|
Provenance
The following attestation bundles were made for flask_forge_cli-1.0.1-py3-none-any.whl:
Publisher:
release.yml on NastMz/flask-forge
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
flask_forge_cli-1.0.1-py3-none-any.whl -
Subject digest:
c3c75cebaeffdca30d0cfb1441ac326cd7a4f2be0d0fba29e1fb3df228453eba - Sigstore transparency entry: 540247259
- Sigstore integration time:
-
Permalink:
NastMz/flask-forge@7d881d87f6c62b70fe0079f624040465d480c7fe -
Branch / Tag:
refs/tags/v1.0.7 - Owner: https://github.com/NastMz
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@7d881d87f6c62b70fe0079f624040465d480c7fe -
Trigger Event:
push
-
Statement type: