Skip to main content

simple_module_users

Email+password user management for simple_module apps. Replaces Keycloak/Auth0 for the common case: local accounts, admin invites, password reset, optional public signup. Built on fastapi-users.

Install

pip install simple_module_users

Pre-wired into any app scaffolded with smpy new.

What it provides

  • Email + password registration, login, logout, password reset.
  • Admin invite flow — admin enters an email, recipient clicks a link, sets a password, is logged in.
  • Public signup toggle (SM_USERS_ALLOW_SIGNUP, default false).
  • Bootstrap admin via env vars (SM_USERS_BOOTSTRAP_EMAIL + SM_USERS_BOOTSTRAP_PASSWORD) — idempotent, only creates if the users table is empty.
  • smpy users create-admin CLI for ad-hoc admin creation.
  • Inertia pages for login/register/invite-accept/admin-invite.
  • Console mailer (logs to stdout) or SMTP mailer (SM_USERS_MAILER=smtp).
  • Demo mode — one-click, read-only shared admin and standard user accounts on the sign-in card, for public showcase instances.

Usage

CLI:

uv run smpy users create-admin --email admin@example.com --password 'change-me'

Bootstrap-on-boot (.env):

SM_USERS_BOOTSTRAP_EMAIL=admin@example.com
SM_USERS_BOOTSTRAP_PASSWORD=change-me

Program:

from auth.deps import CurrentUser  # type: ignore[import-not-found]


@router.get("/profile")
async def profile(user: CurrentUser):
    return {"email": user.email}

Depends on

  • simple_module_core, simple_module_db, simple_module_hosting, simple_module_settings, simple_module_auth
  • fastapi-users[sqlalchemy,oauth]>=15,<16, aiosmtplib, cachetools, typer

Demo mode

For hosting a public showcase instance. Set under /admin/settings/ → Users:

demo_mode        = true
demo_admin_email = demo-admin@example.com
demo_user_email  = demo-user@example.com
demo_read_only   = true    # default — keep it on

The sign-in card grows one button per configured account — Explore as an administrator and Explore as a standard user — each posting to POST /api/users/auth/demo/{role}. Neither account's password reaches the browser. Two accounts because the admin surface is what the framework is for and the end-user app is what you build with it; a visitor can switch between them without signing out. Blank either email to offer only the other; that closes its route too, not just its button.

Both accounts are seeded (and reconciled) at boot and on every settings reload, and while demo_read_only is on, DemoReadOnlyMiddleware refuses every unsafe HTTP method from either demo session — everyone else on the instance is unaffected. A standing banner tells the visitor they are in a demo.

Full detail, including the demo_read_only = false warning, is in docs/modules/users.md.

Social sign-in (Google, GitHub, Microsoft, OIDC)

OAuth providers are configured in the admin UI at /settings/modules → Users (no environment variables). Each provider activates once its client id and secret are set; the secret is masked in the UI. Changes apply live — no restart.

Microsoft (Entra ID). Register an app in the Entra admin center and set the redirect URI to <base-url>/api/users/auth/microsoft/callback. Configure under the Microsoft OAuth group:

  • oauth_microsoft_client_id, oauth_microsoft_client_secret
  • oauth_microsoft_tenant — common (any work/school or personal account, the default), organizations (work/school only), or your tenant GUID to restrict sign-in to one tenant.

Each provider's callback URL is <base-url>/api/users/auth/<provider>/callback (google, github, microsoft, oidc).

Note: for Microsoft guest/external accounts the identity email comes from the Graph userPrincipalName, which may not be a plain email (e.g. user_ext.com#EXT#@tenant.onmicrosoft.com). For tenant members it is the user's email.

Migrating from SM_USERS_OAUTH_* env vars

Earlier versions read provider credentials from SM_USERS_OAUTH_* environment variables. These are no longer read at runtime. Migrate existing values into the settings store once with:

uv run smpy settings import-from-env

License

MIT — see LICENSE.

Metadata

Release files for simple-module-users 0.0.37

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

Source distribution (sdist)

Source distribution for simple-module-users 0.0.37
File Size Uploaded Provenance
simple_module_users-0.0.37.tar.gz 237.9 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for simple-module-users 0.0.37
File Interpreter ABI Platform
simple_module_users-0.0.37-py3-none-any.whl Python 3 none any Details

Total release size: 449.1 kB

Release files / simple_module_users-0.0.37.tar.gz

Download URL simple_module_users-0.0.37.tar.gz
Size 237.9 kB
Tags Source
SHA-256 checksum
How to use checksums
78fd6d2c949119d1494e302a690d04f4c41202cc5a667f91495abccfc8038f47
BLAKE2b-256 checksum
How to use checksums
f496a27dd200a8e5d7acb0013407e98cfa0ac5a4947e7474a197392949de196f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 19, 2026.

Transparency log

Release files / simple_module_users-0.0.37-py3-none-any.whl

Download URL simple_module_users-0.0.37-py3-none-any.whl
Size 211.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c92a0bb13bdb9c3ad60c0f8a654402965ca02460116df40e3bed90e6ef51c9b3
BLAKE2b-256 checksum
How to use checksums
fad4325f2fa31fda6bf6522f83979d32f725c469e0f1cf7319ee681774583200
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 19, 2026.

Transparency log

Security for simple-module-users 0.0.37

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.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for simple_module_users-0.0.37.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 19, 2026.

Transparency log

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.0.37 This release

2 release files Full 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