Skip to main content

A scaffold-first FastAPI micro-framework with a module-oriented CLI

Project description

KAYFRAMEWORK

A scaffold-first FastAPI micro-framework for teams that want a repeatable starting architecture, a consistent CLI workflow, and full ownership of generated application code.

PyPI: https://pypi.org/project/kayframework/

Quickstart

pip install kayframework
kay new app myservice
cd myservice
pip install -e .
uvicorn app.main:app --reload

Why This Framework Exists

KAYFRAMEWORK exists to solve a practical gap:

  • FastAPI gives primitives, not a standardized project system.
  • Teams often rebuild the same app skeleton and CLI scripts repeatedly.
  • Starter templates become unmaintained, inconsistent, or hard to scale across services.

KAYFRAMEWORK provides a stable scaffold workflow while keeping generated projects decoupled from framework internals.

Who It Is For / Not For

For:

  • Teams building multiple FastAPI services with a shared baseline architecture.
  • Developers who want opinionated scaffolding but flexible implementation.
  • Projects that value CLI-driven consistency (new, module, lint, doctor, build).

Not for:

  • Teams needing a batteries-included monolith like Django admin + ORM conventions.
  • Projects expecting runtime plugin magic managed by the framework package itself.
  • Users who only need a single minimal script-level API app.

Key Features

  • src-layout packaging with clean import boundaries.
  • Scaffold template separated from runtime package internals.
  • CLI for project/module generation and developer workflow commands.
  • Module-oriented generated app structure (app/modules/...).
  • GitHub-ready repo baseline (CI, contribution docs, issue/PR templates).

Architecture Overview

src/
  kayframework/
    cli/
      main.py
    core/
      scaffold.py
    modules/
      scaffold.py
    utils/
      process.py
    project_template/
      app/
        ... generated application scaffold ...

docs/
examples/
tests/

Design model:

  • kayframework package: tooling, scaffolding, CLI.
  • project_template: copied into new projects by kay new app.
  • Generated apps: independent codebases you fully own and modify.

CLI

kay new app <name> [--dir .]
kay new module <name> [--app-dir app]
kay run [--app app.main:app] [--host 127.0.0.1] [--port 8000] [--no-reload]
kay test [path]
kay lint [path]
kay format [path]
kay typecheck [path]
kay build
kay clean [--dir .]
kay init [--dir .]
kay doctor [--dir .]
kay version

CLI conventions:

  • Non-zero exit codes on failure.
  • Deterministic scaffold generation.
  • Commands target local project directories explicitly.

Module System

Generated apps include module loading via MODULES in .env.

Example:

MODULES=billing,notifications

Each module lives under app/modules/<module_name>/ and exposes router in routes.py.

Comparison

Capability KAYFRAMEWORK FastAPI Flask Django
Opinionated scaffold generation Yes No No Yes
Lightweight micro-framework runtime Yes Yes Yes No
Built-in monolith features (admin, ORM conventions) No No No Yes
CLI-first project/module generation Yes Partial Partial Yes
Generated code ownership model Full N/A N/A Partial

Installation

Framework package:

pip install kayframework

Development setup:

python -m venv .venv
source .venv/bin/activate
pip install -e ".[dev]"

Development Workflow

kay lint
kay typecheck
kay test
kay build

CI mirrors the same checks in .github/workflows/ci.yml.

Security Notes

For generated projects:

  • Replace SECRET_KEY before deployment.
  • Use ENV=prod and COOKIE_SECURE=true under HTTPS.
  • Do not commit .env.
  • Add rate limiting, audit logging, and deployment hardening based on your risk model.

License

See 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

kayframework-0.2.1.tar.gz (19.3 kB view details)

Uploaded Source

Built Distribution

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

kayframework-0.2.1-py3-none-any.whl (25.6 kB view details)

Uploaded Python 3

File details

Details for the file kayframework-0.2.1.tar.gz.

File metadata

  • Download URL: kayframework-0.2.1.tar.gz
  • Upload date:
  • Size: 19.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for kayframework-0.2.1.tar.gz
Algorithm Hash digest
SHA256 797da8949acb81882f5317fa68a6005a259f0b2a3a03c490e3153ef30ce50b24
MD5 2acba0fa8ac4051c8dfbbd34be45ae12
BLAKE2b-256 a31b82ad9d416d23f01d1edf3e33be6190486151a31bf3e916a38713c90de4cd

See more details on using hashes here.

File details

Details for the file kayframework-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: kayframework-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 25.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for kayframework-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 83d3e2d03d99f0d98a0f99ae341d42d7c81189796751c9cb066a2f87005b1d3e
MD5 67087fa531670b5f87157fd64964c363
BLAKE2b-256 b8b90a1c5873570684216eceb92db1d64fd39b21c698e31ee1bba595b4231d05

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