Contributing¶
Dev Setup¶
Prerequisites: Python 3.12, uv, Node.js 18+, Docker.
git clone <repo-url> && cd identity-service
make setup # Generate keys, TLS certs, .env files, install deps, start DB containers
make start # Start Sentinel on :9003 (auto-migrates)
make admin # Start admin panel on :9004 (optional)
After setup, add OAuth credentials and admin emails to service/.env:
Seed test data (optional):
Project Structure¶
identity-service/
├── service/ # FastAPI microservice
│ ├── src/
│ │ ├── main.py # App entry point, middleware stack, lifespan
│ │ ├── config.py # Pydantic settings (env vars)
│ │ ├── api/ # Route handlers (auth, admin, permissions, roles, etc.)
│ │ ├── models/ # SQLAlchemy 2.0 models
│ │ ├── services/ # Business logic layer
│ │ ├── middleware/ # Security headers, CORS, rate limiting
│ │ ├── auth/ # JWT signing, JWKS, OAuth providers
│ │ └── schemas/ # Pydantic request/response schemas
│ ├── migrations/ # Alembic migration scripts
│ └── tests/ # Service tests
├── sdk/ # Python SDK (sentinel-auth-sdk)
│ ├── src/sentinel_auth/
│ └── tests/
├── sdks/ # JS/TS SDKs
│ ├── js/ # @sentinel-auth/js
│ ├── react/ # @sentinel-auth/react
│ └── nextjs/ # @sentinel-auth/nextjs
├── admin/ # React admin panel (Vite + Tailwind)
├── docs/ # MkDocs Material documentation
├── keys/ # JWT keys + TLS certs (gitignored)
├── docker-compose.yml # Dev containers (Postgres + Redis)
└── Makefile # All common commands
The project is a uv workspace with members = ["service", "sdk"].
Code Style¶
Linter and formatter: ruff (configured in service/pyproject.toml).
Run make fmt before committing.
Key conventions:
- SQLAlchemy 2.0
mapped_columndeclarative style - Async everywhere (SQLAlchemy async, httpx async, FastAPI async handlers)
- RBAC action names:
^[a-z][a-z0-9_.:-]*$, namespaced byservice_name - All primary keys are UUID v4
Running Tests¶
cd service && uv run pytest # Service tests
cd sdk && uv run pytest # SDK tests
cd service && uv run pytest -x # Stop on first failure
See Testing for details on test structure and conventions.
Useful Commands¶
| Command | Description |
|---|---|
make setup |
One-time setup (keys, certs, deps, containers) |
make start |
Start service on :9003 |
make admin |
Start admin UI on :9004 |
make seed |
Seed test data |
make lint |
Run ruff linter + format check |
make fmt |
Auto-fix lint and formatting |
make docs-serve |
MkDocs live reload |
make clean |
Stop containers, wipe DB |
make nuke |
Full reset (containers + keys + deps + env files) |
make release VERSION=x.y.z |
Release all packages |