Skip to main content

🚀 Quick Start

Create FastAPI App for more visit https://fastapi.tiangolo.com/

⚙️ Installation

pip install fast-mu-builder

🚀 Setting Up a Custom User Model in FastAPI with Tortoise ORM + FastAPI-Builder

This guide explains how to create a package module for your User model, extend it from AbstractUser, configure it in Tortoise ORM, and generate GraphQL + migrations.


📂 Project Structure

myapp
  ├── mymodel_package
  │   ├── __init__.py
  │   └── models
  │       └── ..
  ├── config
  │   ├── __init__.py
  │   └── tortoise.py
  ├── main.py
  └── ...

🗄️ 3. Create Tortoise ORM Config

Inside config/tortoise.py:

from decouple import config

db_url = f"postgres://{config('DB_USER')}:{config('DB_PASSWORD')}@{config('DB_HOST')}:{config('DB_PORT')}/{config('DB_NAME')}"

TORTOISE_ORM = {
    "connections": {"default": db_url},
    "apps": {
        "models": {
            "models": [
                "fast_mu_builder.models",   # built-in models
                "mymodel_package.models",    # your custom models
                "aerich.models",             # migration tracking
            ],
            "default_connection": "default",
        },
    },
    "use_tz": True,  # Enable timezone-aware datetimes
    "timezone": "Africa/Dar_es_Salaam",  # Set to EAT (Dar es Salaam)
}

🔧 4. Generate CRUD APIs via GraphQL

Run the following to scaffold GraphQL CRUD APIs:

# For your custom User model
graphql gen:crud-api user_management --module-package=mymodel_package.models --model User

# For fast_mu_builder built-in models
graphql gen:crud-api user_management --module-package=fast_mu_builder.models --model Group,Permission,Headship
graphql gen:crud-api workflow --module-package=fast_mu_builder.models --model Workflow,WorkflowStep,Transition,Evaluation

For your Models

# 
graphql gen:crud-api <module-name> --model Model1,Model2,Model3

# generating graphql schemas with attachments

graphql gen:crud-api <module-name> --model ModelName --with-attachment

# generating graphql schemas with transition
graphql gen:crud-api <module-name> --model ModelName --with-transition

📦 5. Initialize Aerich (DB migrations)

# Initialize Aerich with your Tortoise ORM config
aerich init -t config.tortoise.TORTOISE_ORM

# Create initial migration & database tables
aerich init-db

📖 Documentation

Coming soon...


🤝 Contributing

Contributions, issues, and feature requests are welcome!
Feel free to check the issues page.


📜 License

This project is licensed under the MIT License.

Thanks

Thanks for all the contributors that made this library possible, also a special mention to Japhary Juma, Shija Ntula and Juma Nassoro.

Metadata

Release files for fast-mu-builder 0.1.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for fast-mu-builder 0.1.1.1
File Size Uploaded Provenance Actions
fast_mu_builder-0.1.1.1.tar.gz 84.1 kB Without provenance Details for fast_mu_builder-0.1.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for fast-mu-builder 0.1.1.1
File Interpreter ABI Platform Actions
fast_mu_builder-0.1.1.1-py3-none-any.whl Python 3 none any Details for fast_mu_builder-0.1.1.1-py3-none-any.whl

Total release size: 191.0 kB

Release files / fast_mu_builder-0.1.1.1.tar.gz

Download URL fast_mu_builder-0.1.1.1.tar.gz
Size 84.1 kB
Tags Source
SHA-256 checksum
How to use checksums
53c6b1da7c6895ba5f0c2345b422df42e37d01bc195ff1f851f3355ec97034ad
BLAKE2b-256 checksum
How to use checksums
37743cf5c7312859d21400f893369710503d419d658d232fec303ba5679630f7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.10

Release files / fast_mu_builder-0.1.1.1-py3-none-any.whl

Download URL fast_mu_builder-0.1.1.1-py3-none-any.whl
Size 106.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3a75c1e8ff8cc6fd551ddb76cc830533660df193012b18d7b85d456978be9948
BLAKE2b-256 checksum
How to use checksums
78b5230ee6e529b0a97c8c62667b3f7b494d1c8ed41f98d84fda29af081086b3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.10

Security for fast-mu-builder 0.1.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page