Hex version Docs CI

Production-minded authentication for Phoenix 1.8+ — sessions, passwords, email flows, OAuth, MFA, passkeys, optional organizations and admin tooling — without treating security-sensitive code as throwaway scaffolding.

TL;DR

  • Problem: Pow does not support Phoenix 1.8+. Rolling your own auth across crypto, sessions, MFA, and OAuth is slow and risky.
  • What Sigra is: A library of hardened primitives plus generators that emit normal Phoenix modules into your repo — you patch UX and policy; you mix deps.update the sensitive core.
  • When to leave: You want a hosted identity product (Auth0-as-app) or a framework that hides all auth code from the repo entirely — different tradeoffs.

Pick your lane

You are…Do this first
EvaluatingSkim Where code lives (diagram), What ships, then open HexDocs for API depth.
IntegratingRun First integration (diagram + commands), read Prerequisites, then follow Installation and Getting started.
ContributingMatch toolchain pins in .tool-versions, run Postgres-backed tests per CLAUDE.md in the repo, read CONTRIBUTING.md; use the reference example app as the integration host.
Maintaining / releasingSee MAINTAINING.md for version bumps, Hex and GitHub releases, and planning hygiene for maintainers.

Use this in production

Sigra v1.20.0 marks the project's General Availability. The authentication primitives have been proven through extensive automated testing and documented security attestations.

  1. Add {:sigra, "~> 1.20"} to your mix.exs.
  2. Follow Getting started to generate your host application's auth surface.
  3. Review the Production checklist for scheme, cookies, LiveView origins, and mail delivery posture.

For production confidence and audit evidence:

Milestone planning (maintainers): Product north star and scope boundaries for GSD live in .planning/PROJECT.md under North Star (milestones) (with Core Value and Out of Scope).


Where code lives

flowchart LR
  subgraph SigraPkg [Sigra_hex_package]
    directionTB
    LibCore[Crypto_tokens_MFA_OAuth_plugs]
    LibBehaviours[Behaviours_and_options]
  end
  subgraph HostRepo [Your_application]
    directionTB
    GenCtx[Generated_contexts_schemas]
    GenWeb[Generated_routes_LiveViews]
  end
  SigraPkg -->|"call_into_Sigra"| GenCtx
  SigraPkg -->|"call_into_Sigra"| GenWeb
  GenWeb -->|"you_edit_copy_and_policy"| GenWeb
  • Left: ships on Hex; security fixes ride mix deps.update.
  • Right: plain Elixir under lib/my_app/ and lib/my_app_web/ — code review and product iteration happen there.

First integration

flowchart TD
  A[mix_deps_get]
  B["mix_sigra_install_Context_Schema_table"]
  C[mix_ecto_migrate]
  D[mix_phx_server]
  A --> B --> C --> D
  1. Dependency (mix.exs):

    {:sigra, "~> 0.2"}
  2. Scaffold (from app root; names must match your domain):

    mix deps.get
    mix sigra.install Accounts User users
    
  3. Database + run:

    mix ecto.migrate
    mix phx.server
    

Branching installer flags (--no-live, --admin, --api, …) are summarized below; every switch and default is documented in source (lib/mix/tasks/) and, when published, on HexDocs alongside the API reference.


Prerequisites

RequirementNotes
Elixir~> 1.18 (see mix.exs); align local toolchains with .tool-versions on GitHub.
Phoenix1.8.x baseline the library targets.
DatabaseEcto + typical Postgres setup for the happy path; other adapters are handled in generated migrations where applicable.
MailerEmail flows expect Swoosh (or compatible) wiring — see Installation.

Installer at a glance

IntentExample flagsRead more
Controllers only (no LiveView UI)--no-livemix sigra.install source, HexDocs
API / JWT surface--api, or --jwt (implies API pieces)API authentication, sigra.install source
Admin LiveView suitedefault on; --no-admin to omitsigra.install source
Passkeysdefault on; --no-passkeys to omitPasskeys recipe
Organizationsdefault on; --no-organizations to omitMulti-tenant recipe
UUID primary keysdefault on; --no-binary-id for bigint IDssigra.install source
OAuth slice only (existing install)mix sigra.gen.oauth …OAuth flow, sigra.gen.oauth source

What ships in the box

One clause each — depth lives in HexDocs and the guides linked in the next section.

AreaYou get
IdentityArgon2id passwords, optional bcrypt → Argon2id upgrade on login, remember-me, sudo / step-up hooks.
SessionsDatabase-backed sessions, device/IP metadata hooks, revocation patterns the generators wire up.
EmailRegistration, confirmation (link + code), magic link, reset, lifecycle mailers — Swoosh-shaped templates in the host.
MFATOTP (NimbleTOTP), backup codes, lockout-aware verification; trust-this-device patterns in the example app.
OAuthAssent-backed strategies, encrypted token fields when Cloak is in play; optional mix sigra.gen.oauth for incremental adoption.
PasskeysWebAuthn via wax_ when enabled — registration + authentication ceremonies with host-owned credential rows.
OrganizationsLogical multi-tenancy (memberships, invitations, scoped plugs) when enabled — not “separate DB per tenant”.
AdminOptional installer-generated admin LiveView (global + org lenses), impersonation guardrails, audit surfaces when enabled.
AuditStructured audit logging hooks feeding explorer/export flows where the installer emitted them.

Topic map → guides

TopicGuide
Installation & envintroduction/installation.md
First happy pathintroduction/getting-started.md
Upgrade notesv1.0 → v1.1 · toward v1.7 · toward v1.8
Registrationflows/registration.md
Login / logoutflows/login-and-logout.md
Password resetflows/password-reset.md
Account lifecycleflows/account-lifecycle.md
OAuthflows/oauth.md
MFAflows/mfa.md
API / JWTflows/api-authentication.md
Audit loggingflows/audit-logging.md, audit semantics
Deploymentrecipes/deployment.md
Testingrecipes/testing.md
Passkeysrecipes/passkeys.md
Multi-tenant patternsrecipes/multi-tenant.md
Custom user fieldsrecipes/custom-user-fields.md
Subdomain authrecipes/subdomain-auth.md

Security posture (headlines)

TopicDefault stance
PasswordsArgon2id via configured hasher; bcrypt verify-and-upgrade path when enabled.
TokensHMAC-protected, time-bounded patterns for magic links, reset, confirmation — stored references, not “guessable IDs only”.
EnumerationSafer defaults on account discovery flows (details in HexDocs per flow).
Step-upSudo / MFA challenge patterns integrate with Phoenix plugs and LiveView mounts as generated.

For threat-model detail and per-flow guarantees, use HexDocs and the guides above — the README stays a map, not a spec.

Release evidence (maintainers and auditors)

Sigra keeps an evidence hub (what we ran versus waived for GA cuts, how CI maps to human UAT rows, and pointers to planning artifacts on GitHub). That material is not a compliance certificate for your application — integration and deployment risk stay with the host.

Coordinated disclosure: SECURITY.md.


Reference host: test/example

The test/example tree is a real Phoenix app living inside this repo: it tracks what mix sigra.install (and friends) emit, compiles under --warnings-as-errors in CI, and backs Playwright browser smoke (golden path, org flows, admin checkpoints, GA shift-left specs). It is not a second product — it is the executable contract that installer drift tests and reviewer artifacts refer to. When in doubt about “what does the generator actually produce?”, read that tree or the HexDocs task reference.


Contributing & issues


License

MIT — see LICENSE.