Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

flask_forge_cli-1.0.1.tar.gz (20.3 kB view details)

Uploaded Source

Built Distribution

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

flask_forge_cli-1.0.1-py3-none-any.whl (24.9 kB view details)

Uploaded Python 3

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

Hashes for flask_forge_cli-1.0.1.tar.gz
Algorithm Hash digest
SHA256 264420490d9b12f6d68a144fbe88db706ff613d3e06c799bba88600093c3471e
MD5 4c306008e04ddd79f5533ca3231ed4e4
BLAKE2b-256 eced94a61a8489e4e99e19d25bd72e882108e1879e493c4708c7f7326700d166

See more details on using hashes here.

Provenance

The following attestation bundles were made for flask_forge_cli-1.0.1.tar.gz:

Publisher: release.yml on NastMz/flask-forge

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file flask_forge_cli-1.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for flask_forge_cli-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c3c75cebaeffdca30d0cfb1441ac326cd7a4f2be0d0fba29e1fb3df228453eba
MD5 23d2aa42edaa71404891bc5edd025992
BLAKE2b-256 20cea848accc6494b321aa3056919c15587bc91255343eb9716d77577ce01f37

See more details on using hashes here.

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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