Skip to main content

Open-source FastAPI authentication and authorization library with RBAC, ABAC, and Postgres-backed permissions.

Project description

OutlabsAuth

Open-source FastAPI authentication and authorization for RBAC, ABAC, API keys, and Postgres-backed permission models.

Python 3.12+ License: MIT Stage: Alpha

Alpha release - Public PyPI packaging is supported, but the API surface is still settling before 1.0.

Status

Current Library Version: 0.1.0a11

Release Stage: Alpha

What It Does

OutlabsAuth is a library-first auth system for FastAPI applications that want to keep authentication and authorization inside the app instead of outsourcing it to a separate service.

  • SimpleRBAC and EnterpriseRBAC presets
  • JWT auth, refresh tokens, API keys, service tokens, and OAuth hooks
  • Postgres-backed users, roles, permissions, entities, and audit history
  • FastAPI router factories, middleware, and CLI migrations

Install

pip install outlabs-auth

You will also need a PostgreSQL database available to the consuming app.

The consuming app owns its own configuration. In practice that means you provide:

  • a PostgreSQL connection URL
  • a JWT signing secret
  • any app-specific entity, membership, or host-query integrations you want on top of the base library

Quickstart

from contextlib import asynccontextmanager

from fastapi import FastAPI
from outlabs_auth import SimpleRBAC, register_exception_handlers
from outlabs_auth.routers import get_auth_router

auth = SimpleRBAC(
    database_url="postgresql+asyncpg://postgres:postgres@localhost:5432/app",
    secret_key="change-me",
    auto_migrate=True,
)


@asynccontextmanager
async def lifespan(app: FastAPI):
    await auth.initialize()
    yield
    await auth.shutdown()


app = FastAPI(lifespan=lifespan)
register_exception_handlers(app)
app.include_router(get_auth_router(auth, prefix="/auth"))

This example uses auto_migrate=True for convenience. For production, run migrations explicitly with the packaged CLI instead of relying on startup migration.

CLI Bootstrap

After installation, the package exposes an outlabs-auth CLI for schema setup and initial seeding.

export DATABASE_URL=postgresql+asyncpg://postgres:postgres@localhost:5432/app
# optional: export OUTLABS_AUTH_SCHEMA=auth

outlabs-auth migrate
outlabs-auth seed-system
outlabs-auth bootstrap-admin --email admin@example.com --password change-me

More

The repository includes deeper examples, packaged CLI flows, and design notes:

License

MIT, copyright 2026 OUTLABS LLC.

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

outlabs_auth-0.1.0a11.tar.gz (257.9 kB view details)

Uploaded Source

Built Distribution

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

outlabs_auth-0.1.0a11-py3-none-any.whl (355.9 kB view details)

Uploaded Python 3

File details

Details for the file outlabs_auth-0.1.0a11.tar.gz.

File metadata

  • Download URL: outlabs_auth-0.1.0a11.tar.gz
  • Upload date:
  • Size: 257.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for outlabs_auth-0.1.0a11.tar.gz
Algorithm Hash digest
SHA256 94d2ae3c02a6e57fe43ae1c3076489bf0d64f71c98f92318d85285f0bcc818a2
MD5 eb3ff76fa91a8cc69548042bd8fa1423
BLAKE2b-256 f506105fcb3ad6083d934ee11484c16058962683aaaf95c373650cdb8c8fdb69

See more details on using hashes here.

Provenance

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

Publisher: publish-pypi.yml on outlabsio/outlabsAuth

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

File details

Details for the file outlabs_auth-0.1.0a11-py3-none-any.whl.

File metadata

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

File hashes

Hashes for outlabs_auth-0.1.0a11-py3-none-any.whl
Algorithm Hash digest
SHA256 1e0e2bf9edf9d224d51bb6830045a993b2253c1169127b89bf0fcadcb531e0b7
MD5 c639035a74b33b07c33f57bd8029f45e
BLAKE2b-256 3a52fd97dda22e023c252899bc08d087e48fa22cb6ed8f7bb375976050b0c0e2

See more details on using hashes here.

Provenance

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

Publisher: publish-pypi.yml on outlabsio/outlabsAuth

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