Skip to content

MSF FastAPI Template

This repository is a starter backend built on MSFLib. It wires the core library with the auth, account and workspaces modules into a working FastAPI app, so you start from a running service with accounts, login and workspaces and add your own code on top.

These pages explain how the template is put together. They do not repeat the library documentation: for what a module does, how settings, actions and events work, or how to extend them, follow the links to the MSFLib docs.

What you get

Feature Provided by
Login, logout, password recovery and reset, optional Google sign-in msflib-auth
Accounts, profiles and an admin account router msflib-account
Workspaces and memberships msflib-workspaces and msflib-tenancy (workspaces depend on it)
Settings, database session, key store, seeding msflib core
Celery worker, Dockerfile, Alembic setup, pytest suite This template

Repository layout

app/
    main.py            FastAPI app: CORS, router, static uploads
    bootstrap.py       Startup hooks (see "How the app is wired")
    worker.py          Celery app
    core/config.py     AppSettings
    api/deps.py        Session, key store and account dependencies
    api/api_v1/        Router assembly and endpoint packages
    actions/           One action instance per model
    models/            Re-exports of the module models
    db/                Engine and first-run initialisation
    seed/              Seeders, sample data and the seed CLI
    tests/             Pytest suite
alembic/             Migration environment (no revisions yet)
prestart.sh          Container start-up: wait for DB, migrate, create first data

Where to go next

  1. Getting started: install, configure, run.
  2. Configuration: the settings class and the environment variables the template reads.
  3. How the app is wired: what each file does and where your own code goes.
  4. Database and seeding: creating tables, first-run data and sample data.
  5. Testing and deployment: the test suite, Docker, workers and CI.
  6. Extending the template: adding modules, models and routes.