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.

Download files

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

Source Distribution

fast_mu_builder-0.1.0.30.tar.gz (82.6 kB view details)

Uploaded Source

Built Distribution

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

fast_mu_builder-0.1.0.30-py3-none-any.whl (105.8 kB view details)

Uploaded Python 3

File details

Details for the file fast_mu_builder-0.1.0.30.tar.gz.

File metadata

  • Download URL: fast_mu_builder-0.1.0.30.tar.gz
  • Upload date:
  • Size: 82.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for fast_mu_builder-0.1.0.30.tar.gz
Algorithm Hash digest
SHA256 1020faedf85ebbd1b792e38a01c084e8f2d88e161a1f89fe10e89ab90bf04507
MD5 8070341b0a1a9e19f2e40884a22a2c08
BLAKE2b-256 a79989ba8cc94d69afb975ab5010b2caf689cfb82d05cc6c4602d3da2f497aad

See more details on using hashes here.

File details

Details for the file fast_mu_builder-0.1.0.30-py3-none-any.whl.

File metadata

File hashes

Hashes for fast_mu_builder-0.1.0.30-py3-none-any.whl
Algorithm Hash digest
SHA256 981c7efbf35a7d6544b3880b9dffdb87c4cadf386021e1ae7124f9d22b2e6b30
MD5 aef2e7f2c614fc03d61e53d235c1fa3f
BLAKE2b-256 5ed983e8bad8c41d6185bb3a89d4029b0dd54274719d55684538c1122c279be6

See more details on using hashes here.

Release history Release notifications | RSS feed

0.1.0.31

2 files

This release

0.1.0.30 This release

2 files

0.1.0.29

2 files

0.1.0.28

2 files

0.1.0.27

2 files

0.1.0.26

2 files

0.1.0.25

2 files

0.1.0.24

2 files

0.1.0.23

2 files

0.1.0.22

2 files

0.1.0.21

2 files

0.1.0.20

2 files

0.1.0.19

2 files

0.1.0.18

2 files

0.1.0.17

2 files

0.1.0.16

2 files

0.1.0.15

2 files

0.1.0.14

2 files

0.1.0.13

2 files

0.1.0.12

2 files

0.1.0.11

2 files

0.1.0.10

2 files

0.1.0.9

2 files

0.1.0.8

2 files

0.1.0.7

2 files

0.1.0.6

2 files

0.1.0.5

2 files

0.1.0.4

2 files

0.1.0.3

2 files

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