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.1.0.tar.gz (28.0 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.1.0-py3-none-any.whl (33.1 kB view details)

Uploaded Python 3

File details

Details for the file flask_forge_cli-1.1.0.tar.gz.

File metadata

  • Download URL: flask_forge_cli-1.1.0.tar.gz
  • Upload date:
  • Size: 28.0 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.1.0.tar.gz
Algorithm Hash digest
SHA256 9b34bad598e3550c53f3bdda5f53d732d7c6567079e46c4c702b58f571fde1d8
MD5 859ae3f6f7332adfbbd0b53cc3265ab3
BLAKE2b-256 225c55d1984de098a8eb00abfcc2592b05d0220e2de6de1f48fa78cd13af20ac

See more details on using hashes here.

Provenance

The following attestation bundles were made for flask_forge_cli-1.1.0.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.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for flask_forge_cli-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7ee0e49b87561c15421ec1ab6f83c6bd18cca56d9200dc8784391dcd84a78182
MD5 7a2cf42695c120493674620c2895373b
BLAKE2b-256 892249b2056b832c55abd46961674cde6e6492aa72c31b2b5b0f35e8fa56e319

See more details on using hashes here.

Provenance

The following attestation bundles were made for flask_forge_cli-1.1.0-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