Skip to main content

FastKit CLI is a code generation tool for the fastkit core packge.

Project description

FastKit CLI

PyPI version Python 3.11+ CI License: MIT

FastAPI with structure and developer experience.

FastKit CLI is a code generation tool for the FastKit ecosystem. It generates complete, production-ready modules for FastAPI projects — models, schemas, repositories, services, and routers — in seconds.

Inspired by Laravel's php artisan, built for FastAPI developers who want structure without the overhead.


Requirements


Installation

pip install fastkit-cli

Or with uv (recommended):

uv add fastkit-cli

Verify the installation:

fastkit --help

Quickstart

Generate a complete module

fastkit make module Invoice

This generates the following structure:

modules/
└── invoices/
    ├── __init__.py
    ├── models.py
    ├── schemas.py
    ├── repository.py
    ├── service.py
    └── router.py

With a confirmation and next steps:

Generating module: Invoice
  Location : modules/invoices/
  Model    : Invoice
  Table    : invoices
  Mode     : sync

  ✓  __init__.py
  ✓  models.py
  ✓  schemas.py
  ✓  repository.py
  ✓  service.py
  ✓  router.py

  ✓  Registered model in alembic/env.py

Done! Next steps:
  1. Define your fields in  modules/invoices/models.py
  2. Add schemas in          modules/invoices/schemas.py
  3. Run: fastkit migrate make -m 'create_invoices'

Generate an async module

fastkit make module Invoice --async

Generates the same structure but with async repository, service, and router using AsyncSession and get_async_db.


make

fastkit make module

Generates a complete module with all layers.

fastkit make module <Name> [OPTIONS]
Option Short Default Description
--dir -d modules Root directory for modules
--async -a False Use async repository, service, and router
--force -f False Overwrite existing files

Examples:

# Basic usage
fastkit make module Invoice

# Async mode
fastkit make module Invoice --async

# Custom directory
fastkit make module Invoice --dir src/modules

# Compound name (automatically converted)
fastkit make module InvoiceItem

# Overwrite existing files
fastkit make module Invoice --force

fastkit make model

Generates only the SQLAlchemy model file.

fastkit make model <Name> [OPTIONS]
Option Short Default Description
--path -p . Target directory
--force -f False Overwrite existing file

Examples:

fastkit make model Invoice
fastkit make model Invoice --path modules/invoices

Generated models.py:

from fastkit_core.database import BaseWithTimestamps, IntIdMixin
# from fastkit_core.database import UUIDMixin, SoftDeleteMixin, SlugMixin

class Invoice(BaseWithTimestamps, IntIdMixin):
    __tablename__ = "invoices"
    # Define your fields here

fastkit make schema

Generates only the Pydantic schemas file.

fastkit make schema <Name> [OPTIONS]
Option Short Default Description
--path -p . Target directory
--force -f False Overwrite existing file

Examples:

fastkit make schema Invoice
fastkit make schema Invoice --path modules/invoices

Generated schemas.py:

from fastkit_core.validation import BaseSchema

class InvoiceCreate(BaseSchema):
    pass  # Define your fields here

class InvoiceUpdate(BaseSchema):
    pass  # All fields optional for partial updates

class InvoiceResponse(BaseSchema):
    id: int
    model_config = {"from_attributes": True}

fastkit make repository

Generates only the repository file.

fastkit make repository <Name> [OPTIONS]
Option Short Default Description
--path -p . Target directory
--async -a False Use async repository
--force -f False Overwrite existing file

Examples:

fastkit make repository Invoice
fastkit make repository Invoice --async
fastkit make repository Invoice --path modules/invoices

fastkit make service

Generates only the service file.

fastkit make service <Name> [OPTIONS]
Option Short Default Description
--path -p . Target directory
--async -a False Use async service
--force -f False Overwrite existing file

Examples:

fastkit make service Invoice
fastkit make service Invoice --async

fastkit make router

Generates only the router file with full CRUD endpoints.

fastkit make router <Name> [OPTIONS]
Option Short Default Description
--path -p . Target directory
--async -a False Use async router
--force -f False Overwrite existing file

Examples:

fastkit make router Invoice
fastkit make router Invoice --async

Generated endpoints:

GET    /invoices        → index   (paginated list)
GET    /invoices/{id}   → show
POST   /invoices        → store
PUT    /invoices/{id}   → update
DELETE /invoices/{id}   → destroy

migrate

Wrapper around Alembic migrations.

fastkit migrate run

Run all pending migrations.

fastkit migrate run
# Equivalent to: alembic upgrade head

fastkit migrate make

Generate a new migration based on model changes.

fastkit migrate make -m "create_invoices"
# Equivalent to: alembic revision --autogenerate -m "create_invoices"
Option Short Required Description
--message -m Yes Migration description

fastkit migrate rollback

Rollback the last migration.

fastkit migrate rollback
# Equivalent to: alembic downgrade -1

fastkit migrate status

Show the current migration status.

fastkit migrate status
# Equivalent to: alembic current

db seed

Run database seeders.

# Run all seeders
fastkit db seed

# Run a specific seeder
fastkit db seed UserSeeder

server

Start the FastAPI development server.

fastkit server
Option Short Default Description
--host -h 0.0.0.0 Host to bind
--port -p 8000 Port to bind
--reload / --no-reload True Enable auto-reload

Examples:

# Default
fastkit server

# Custom host and port
fastkit server --host 127.0.0.1 --port 9000

# Without auto-reload
fastkit server --no-reload

new

Create a new FastKit project from a template.

fastkit new my-project

Naming Conventions

FastKit CLI automatically handles naming conversions regardless of how you pass the module name:

Input Model Snake Table Folder
Invoice Invoice invoice invoices invoices
invoice Invoice invoice invoices invoices
InvoiceItem InvoiceItem invoice_item invoice_items invoice_items
invoice_item InvoiceItem invoice_item invoice_items invoice_items
Category Category category categories categories

Typical Workflow

# 1. Generate a new module
fastkit make module Invoice --async

# 2. Define your model fields
# Edit modules/invoices/models.py

# 3. Define your schemas
# Edit modules/invoices/schemas.py

# 4. Generate and run migration
fastkit migrate make -m "create_invoices"
fastkit migrate run

# 5. Register the router in your main app
# In app.py:
# from modules.invoices.router import router as invoices_router
# app.include_router(invoices_router, prefix="/api/v1")

# 6. Start the server
fastkit server

Related Packages

  • fastkit-core — Base classes, repository pattern, validation, i18n
  • mailbridge — Email delivery abstraction

License

FastKit Core is open-source software licensed under the MIT License.


Built by CodeVelo

FastKit is developed and maintained by Codevelo for the FastAPI community.

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

fastkit_cli-0.1.0.tar.gz (13.3 kB view details)

Uploaded Source

Built Distribution

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

fastkit_cli-0.1.0-py3-none-any.whl (9.3 kB view details)

Uploaded Python 3

File details

Details for the file fastkit_cli-0.1.0.tar.gz.

File metadata

  • Download URL: fastkit_cli-0.1.0.tar.gz
  • Upload date:
  • Size: 13.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for fastkit_cli-0.1.0.tar.gz
Algorithm Hash digest
SHA256 3f7408a34d1ae5f43d2cc9dffab155441d951b5bba513393b79b0554a1c2c888
MD5 b6a2c2ce9ceca7133d4e563cfcec6621
BLAKE2b-256 ccb6e7e4e5970154c1f7083562354e9e5635f2b9902c4000e9338adde6e5d873

See more details on using hashes here.

Provenance

The following attestation bundles were made for fastkit_cli-0.1.0.tar.gz:

Publisher: test_publish.yaml on codevelo-pub/fastkit-cli

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

File details

Details for the file fastkit_cli-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: fastkit_cli-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 9.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for fastkit_cli-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ca69f8f38fdb14148304cc8898695991f9f4df43723dcb173e5650cfdb7a0211
MD5 8f63e91c27c94fa1bcbb7c5998db57c6
BLAKE2b-256 4a1adfd230c91fecb72de6c4ab0897d64412305ac3f23d36d8aae824872dba62

See more details on using hashes here.

Provenance

The following attestation bundles were made for fastkit_cli-0.1.0-py3-none-any.whl:

Publisher: test_publish.yaml on codevelo-pub/fastkit-cli

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