authSDK is a central authentication platform plus a reusable Python SDK for
downstream services.
The repository contains two closely related deliverables:
app/: a FastAPI auth service that owns identity, sessions, token issuance, API keys, OTP, lifecycle flows, admin APIs, key rotation, audit logging, and webhookssdk/: theauth-service-sdkpackage used by other services to validate JWTs and API keys and enforce authorization locally
This project is meant for a multi-service architecture where authentication state lives in one place and application services consume that trust boundary through the SDK.
Typical use cases:
- centralize sign-in, refresh, logout, and session revocation
- issue audience-scoped JWTs for multiple downstream services
- support OTP, password reset, email verification, OAuth, and SAML in one deployable service
- give consuming services a thin, reusable middleware layer instead of duplicating auth code
+----------------------+
| Downstream App |
| (FastAPI/Starlette) |
+----------+-----------+
|
auth-service-sdk middleware/dependencies
|
v
+-----------+ +--------+--------+ +-----------+
| User/App +--------------->+ auth-service +-------------->+ Postgres |
+-----------+ +--------+--------+ +-----------+
|
+--------------> Redis
|
+--------------> webhook worker
|
+--------------> scheduler / retention
The auth service exposes public auth endpoints, admin endpoints, JWKS, token
validation, API-key introspection, webhook management, and health probes.
Downstream services install auth-service-sdk and trust the auth service for
verification and session state.
- email/password signup and login
- JWT access and refresh tokens
- audience-scoped access tokens for downstream APIs
- server-side session validation and logout
- API key issuance and introspection
- OTP login and step-up action tokens
- email verification and password reset flows
- Google OAuth and SAML entry points
- admin APIs for users, clients, API keys, audit log, signing keys, and webhooks
- signing-key rotation with overlap windows and JWKS publishing
- rate limiting, structured logging, correlation IDs, tracing, metrics, and security headers
- background webhook delivery and scheduled retention purge
app/ FastAPI service, routers, schemas, services, middleware
sdk/ publishable Python SDK for consuming services
docs/ architecture, configuration, API, operations, troubleshooting
tests/ unit and integration coverage
loadtests/ Locust scenarios and result artifacts
docker/ Dockerfile and local compose stack
migrations/ Alembic environment and revisions
workers/ background job entrypoints
- Copy the local environment template.
Copy-Item .env-sample .env- Start the local stack.
docker compose -f docker/docker-compose.yml up --build- Verify the service is healthy.
curl http://localhost:8000/health/readyLocal URLs:
- auth service:
http://localhost:8000 - Swagger UI:
http://localhost:8000/docs - Mailhog:
http://localhost:8025 - Adminer:
http://localhost:8080
Start here based on what you need:
- repository docs hub:
docs/README.md - local development:
DEVELOPMENT.md - system architecture:
docs/architecture.md - configuration reference:
docs/configuration.md - service API guide:
docs/service-api.md - SDK integration:
docs/integrate-sdk.md - testing guide:
docs/testing.md - operations and deployment:
docs/operations.md - troubleshooting:
docs/troubleshooting.md - SDK package guide:
sdk/README.md - load tests:
loadtests/README.md
The SDK package is published as auth-service-sdk and imported as sdk.
It provides:
JWTAuthMiddlewareAPIKeyAuthMiddlewarerequire_role(...)require_action_token(...)require_fresh_auth(...)AuthClient
Install options:
pip install auth-service-sdk
pip install /path/to/authSDK/sdk
pip install "git+https://github.com/<org>/<repo>.git#subdirectory=sdk"The repo includes:
- linting with Ruff
- formatting checks with Black
- unit and integration tests with Pytest
- Alembic migration validation
- service and SDK package builds
Common commands:
python -m ruff check .
python -m black --check .
python -m pytest -q
python -m alembic upgrade head
python -m build
python -m build sdkFor a fuller contributor workflow, see CONTRIBUTING.md.
Rotate signing keys:
python -m app.cli rotate-signing-keyRun background processes outside Docker:
python worker.py
python scheduler.pyGitHub Actions currently covers:
- lint and formatting checks
- unit and integration tests
- Alembic offline and online migration validation
- service package build
- SDK package build and wheel smoke test
- container image publication to GHCR
See .github/workflows/ci.yml and .github/workflows/release.yml for the
authoritative workflow definitions.