No description
  • TypeScript 86.8%
  • Vue 11.7%
  • JavaScript 1%
  • CSS 0.3%
  • Dockerfile 0.2%
Find a file
rainer@meowww.ch 688d787148 chore: release v2.23.0
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-28 17:14:17 +00:00
.claude/skills chore: let Claude invoke the implement, plan-next and smoke skills 2026-10-23 12:15:35 +00:00
app feat: name passkeys and show when each was last used 2026-11-28 17:11:09 +00:00
docs feat: name passkeys and show when each was last used 2026-11-28 17:11:09 +00:00
public fix(config): defaults that hold, password rules, theme, accessibility 2026-10-23 12:12:41 +00:00
scripts fix(scripts): test-jwt-at visits the login page before /finish 2026-11-05 12:53:43 +00:00
server feat: name passkeys and show when each was last used 2026-11-28 17:11:09 +00:00
tests feat: name passkeys and show when each was last used 2026-11-28 17:11:09 +00:00
types Schleuse 1.0 2026-08-20 16:48:26 +00:00
website feat: name passkeys and show when each was last used 2026-11-28 17:11:09 +00:00
.dockerignore fix: audit sweep — 37 bugs and one follow-up from the 2026-11-12 audit 2026-11-12 13:12:51 +00:00
.env.example feat: suspend and delete users through the provisioning API 2026-11-28 17:11:08 +00:00
.gitignore Schleuse 1.0 2026-08-20 16:48:26 +00:00
.gitlab-ci.yml build: Node 24, runtime image without npm/corepack/yarn 2026-11-25 17:42:00 +00:00
CHANGELOG.md chore: release v2.23.0 2026-11-28 17:14:17 +00:00
CLAUDE.md feat: list signed-in devices and sign out one of them 2026-11-28 12:42:59 +00:00
docker-compose.coolify-sqlite.yml feat: expire self sign-ups that were never verified 2026-11-28 17:11:07 +00:00
docker-compose.coolify.yml feat: expire self sign-ups that were never verified 2026-11-28 17:11:07 +00:00
docker-compose.smoke.yml feat: NUXT_SMTP_TLS_CA and TLS failure diagnosis on the Email & SMTP page 2026-10-23 18:31:09 +00:00
docker-compose.yml feat!: require STARTTLS by default 2026-09-28 20:59:56 +00:00
Dockerfile build: slimmer runtime image (304 → 217 MB) 2026-11-27 19:39:20 +00:00
knexfile.ts refactor: remove dead server code and pointless indirection 2026-10-17 14:06:56 +00:00
nuxt.config.ts feat: expire self sign-ups that were never verified 2026-11-28 17:11:07 +00:00
package.json chore: release v2.23.0 2026-11-28 17:14:17 +00:00
pnpm-lock.yaml fix(deps): clear all pnpm audit advisories 2026-11-25 16:37:28 +00:00
README.md fix: audit sweep — 37 bugs and one follow-up from the 2026-11-12 audit 2026-11-12 13:12:51 +00:00
tailwind.config.ts feat(theme): a dark variant for a light theme; readable status colours 2026-11-05 14:53:27 +00:00
THEMES.md feat(theme): a dark variant for a light theme; readable status colours 2026-11-05 14:53:27 +00:00
tsconfig.json Schleuse 1.0 2026-08-20 16:48:26 +00:00
vitest.config.ts Schleuse 1.0 2026-08-20 16:48:26 +00:00

Schleuse

📖 Public docs: https://schleuse.meowww.dev — landing page, guides, API reference, changelog. Source under website/.

For agents: https://schleuse.meowww.dev/llms.txt is the index, every page is also served as its markdown source (/guide/oidc.md), and https://schleuse.meowww.dev/llms-full.txt is all of it in one file.

A lightweight, self-hosted identity provider designed to run as a sidecar alongside your project. Single-instance deployment — no Redis, no clustering, no external dependencies beyond a database. Supports PostgreSQL and SQLite. In a single deployable image:

  • Login — password, WebAuthn/passkeys (incl. passwordless signup), email verification, password reset
  • Two-factor — authenticator app (TOTP) with backup codes, passkey, or emailed code; optionally mandatory per account or for admins only
  • OIDC provider — Authorization Code Flow with PKCE, refresh tokens, back-channel logout, per-app roles, optional JWT access tokens
  • Admin panel — users, invites, suspensions, roles, audit log, email/config diagnostics
  • Server-to-server APIs — app-roles for OIDC clients, bearer-token provisioning for migrating an existing realm in
  • Operations — bearer-gated Prometheus /metrics, structured JSON logs, new-sign-in alerts, UI and outbound emails in English, German, French and Italian (further languages via per-locale env overrides)

SMTP is optional — without it, users are auto-verified and email-based 2FA and password reset are unavailable (TOTP and passkeys still work), which keeps local development frictionless. JWT and TOTP encryption keys are auto-generated on first start.

Working on this repo? See docs/ — FEATURES.md, BUGS.md, FOLLOW_UP.md are the catalogues used by the /plan-next, /implement, and /smoke skills. Plans and implementation records live under docs/plans/ and docs/implementation/.

Layer Tech
Framework Nuxt 4 (Nitro server)
Database PostgreSQL 16 or SQLite (better-sqlite3) + Knex.js
Auth JWT, argon2id, WebAuthn (SimpleWebAuthn), TOTP (otpauth), OIDC (oidc-provider v9)
Validation Zod 4
Styles Tailwind CSS 3 + CSS custom properties (runtime theming)
Logging pino (structured JSON)
Metrics @prometheus-io/client (bearer-gated Prometheus exposition at /metrics)
Runtime Node.js >= 22

Quick Start

The minimal setup requires only a database and OIDC client config -- JWT keys are auto-generated on first start and persisted to the data/ volume. The app image is published to the GitLab container registry — no local build needed.

cp .env.example .env
# Edit .env: set NUXT_DATABASE_URL, NUXT_ISSUER, NUXT_APP_URL,
# NUXT_RP_ID, NUXT_RP_NAME, NUXT_RP_ORIGIN, NUXT_OIDC_CLIENTS_JSON

docker compose pull
docker compose up -d

App: http://localhost:5000 Mailcatcher UI: http://localhost:1080

Working from a git checkout and want to build the image locally instead? docker compose up --build still works — the root docker-compose.yml keeps a build: stanza for contributors.

Minimal docker-compose.yml

For deploying with an existing PostgreSQL database or using SQLite:

services:
  schleuse:
    image: registry.gitlab.com/meowww_dev/schleuse:latest
    ports:
      - "3000:3000"
    volumes:
      - app_data:/app/data   # auto-generated keys + SQLite DB (if used)
    environment:
      NODE_ENV: production
      # Database -- PostgreSQL or SQLite
      NUXT_DATABASE_URL: sqlite:/app/data/schleuse.db
      # URLs -- must match your domain
      NUXT_ISSUER: https://auth.example.com/oidc
      NUXT_APP_URL: https://auth.example.com
      # WebAuthn
      NUXT_RP_ID: auth.example.com
      NUXT_RP_NAME: My App
      NUXT_RP_ORIGIN: https://auth.example.com
      # OIDC clients
      NUXT_OIDC_CLIENTS_JSON: >
        [{"clientId":"my-app",
          "redirectUris":["https://my-app.example.com/callback"],
          "grantTypes":["authorization_code","refresh_token"],
          "scopes":["openid","email","profile","offline_access"],
          "public":true}]
      # Optional: SMTP for email verification + 2FA
      # NUXT_SMTP_HOST: smtp.example.com
      # NUXT_SMTP_PORT: "587"
      # NUXT_SMTP_USER: apikey
      # NUXT_SMTP_PASS: secret
      # NUXT_SMTP_FROM: "Auth <noreply@example.com>"
      # NUXT_TWO_FACTOR_ENABLED: "true"
      # Optional: bring your own keys (otherwise auto-generated)
      # NUXT_JWT_SECRET: <random-string-at-least-32-chars>
      # NUXT_JWT_PRIVATE_KEY: <RSA-PEM-with-escaped-newlines>

volumes:
  app_data:

That's it. On first start, the container:

  1. Auto-generates jwt-secret.txt and jwt-private-key.pem in /app/data/
  2. Runs database migrations
  3. Serves the app on port 3000

The first registered user is automatically promoted to admin.

Local development

docker compose up postgres mailcatcher -d
pnpm install
cp .env.example .env   # edit as needed
pnpm dev

Migrations run automatically at startup.


Configuration

All variables use Nuxt's runtimeConfig convention:

  • NUXT_<KEY> -- server-only (never sent to the browser)
  • NUXT_PUBLIC_<KEY> -- exposed to the client

Nuxt maps these to useRuntimeConfig() at runtime -- no rebuild needed to change config.

The tables below name every variable. website/guide/configuration.md describes each one in full, and .env.example shows them with examples.

Server-only (NUXT_*)

Variable Required Default Description
NUXT_DATABASE_URL yes Database URL. PostgreSQL: postgresql://... — SQLite: sqlite:./data.db or :memory:
NUXT_JWT_SECRET no auto >= 32 random characters for HMAC signing. Auto-generated if not set, persisted to data/jwt-secret.txt
NUXT_JWT_PRIVATE_KEY no auto RSA 2048 PKCS8 PEM, \n-escaped for .env. Auto-generated if not set, persisted to data/jwt-private-key.pem
NUXT_JWT_PRIVATE_KEY_PREVIOUS no Retired signing key, kept in the JWKS verify-only during a no-downtime rotation. Same PEM format. Empty = single-key
NUXT_TOTP_ENCRYPTION_KEY no auto >= 16 chars, encrypts authenticator (TOTP) secrets at rest. Auto-generated to data/totp-encryption-key.txt. Back it up with the data dir -- rotating it makes existing enrolments undecryptable
NUXT_DATA_DIR no data/ Directory for the three auto-generated key files (default: data/ under the working directory). Moves the key files only, not a relative SQLite path
NUXT_ISSUER yes OIDC issuer URL, must end with /oidc
NUXT_APP_URL yes Browser-reachable base URL
NUXT_OIDC_CLIENTS_JSON yes JSON array of OIDC client objects (see OIDC Usage)
NUXT_OIDC_RESOURCE_AUDIENCE no Comma-separated audience URIs (RFC 8707). Empty = access tokens stay opaque; when set, a client requesting resource=<audience> gets a JWT access token
NUXT_OIDC_RESOURCE_SERVERS_JSON no Richer JWT-AT config: array of { audience, scopes?, accessTokenTTL? }. Overrides NUXT_OIDC_RESOURCE_AUDIENCE per audience
NUXT_BACKCHANNEL_LOGOUT_RETRY_DELAYS_MS no 2000,15000 Comma-separated backoff before each back-channel-logout re-attempt. Empty = single attempt. In-memory, lost on restart
NUXT_SMTP_HOST no SMTP server hostname. When empty, email features are disabled: users are auto-verified, email 2FA is skipped, password reset unavailable. TOTP and passkey second factors are unaffected
NUXT_SMTP_PORT no 1025 SMTP port
NUXT_SMTP_SECURE no false true for TLS (port 465)
NUXT_SMTP_USER no SMTP auth username
NUXT_SMTP_PASS no SMTP auth password
NUXT_SMTP_FROM no noreply@localhost Sender address, e.g. Schleuse <noreply@example.com>
NUXT_SMTP_REQUIRE_TLS no true On non-465 ports: true requires STARTTLS and a valid certificate, auto upgrades when offered but falls back to cleartext, false disables. For a relay with a private-CA or self-signed certificate set NUXT_SMTP_TLS_CA rather than auto
NUXT_SMTP_TLS_REJECT_UNAUTHORIZED no true Set false to accept any relay certificate — last resort; prefer NUXT_SMTP_TLS_CA
NUXT_SMTP_TLS_CA no — Pin a CA for the SMTP hop (PEM path or inline PEM); keeps validation on for a private-CA or self-signed relay
NUXT_EMAIL_RETRY_DELAYS_MS no 30000,120000 Comma-separated backoff before each re-attempt for outbound email. Empty = single attempt. In-memory, lost on restart. 2FA codes are never retried
NUXT_RP_ID yes WebAuthn relying party domain (e.g. localhost)
NUXT_RP_NAME yes WebAuthn relying party display name
NUXT_RP_ORIGIN yes WebAuthn origin URL (e.g. http://localhost:3000)
NUXT_REGISTRATION_ENABLED no true Set false to disable new user registration
NUXT_AUTO_ADMIN_FIRST_USER no true Automatically promote first registered user to admin
NUXT_TWO_FACTOR_ENABLED no false Enable email-based 2FA (6-digit code after login). TOTP and passkey second factors work independently of this flag
NUXT_MAGIC_LINK_ENABLED no true "Email me a sign-in link" on the login page (single-use, 15 min). Only with SMTP configured; TOTP is still required for accounts that have it
NUXT_MAGIC_LINK_SIGNUP_ENABLED no false "Email link" as a third sign-up method: the account is created by pressing the button behind the emailed link, with no password and no passkey. Only with registration, magic links and SMTP on. Such accounts recover only by magic link
NUXT_REQUIRE_TWO_FACTOR no false Force every account to have a second factor. Users without one are gated to /setup-2fa until they enrol TOTP or a passkey
NUXT_REQUIRE_TWO_FACTOR_SCOPE no all Who the gate applies to: all or admins
NUXT_REQUIRE_TWO_FACTOR_GRACE_DAYS no 0 Grace period (days from account creation) before the gate applies. 0 = immediately
NUXT_SUSPICIOUS_LOGIN_ALERTS no false Email a "new sign-in" alert on a login from a new IP or device. Requires SMTP
NUXT_SUSPICIOUS_LOGIN_STEP_UP no false Force an email-code challenge on a login flagged as suspicious. Requires SMTP. Independent of the alert
NUXT_PASSWORD_POLICY no standard Password complexity preset: simple (6+ chars), standard (8+ with upper/lower/number/special), strong (12+ with all)
NUXT_PASSWORD_MIN_LENGTH no preset Override minimum password length
NUXT_PASSWORD_REQUIRE_UPPERCASE no preset Override: require uppercase letter
NUXT_PASSWORD_REQUIRE_LOWERCASE no preset Override: require lowercase letter
NUXT_PASSWORD_REQUIRE_NUMBER no preset Override: require digit
NUXT_PASSWORD_REQUIRE_SPECIAL no preset Override: require special character
NUXT_PASSWORD_HISTORY_COUNT no 0 Block reuse of the last N passwords (incl. current) on change/reset. 0 = off
NUXT_RATE_LIMIT_LOGIN no 10/15 Login rate limit (maxAttempts/windowMinutes)
NUXT_RATE_LIMIT_REGISTER no 10/60 Registration rate limit
NUXT_RATE_LIMIT_PASSWORD_RESET no 5/60 Password reset rate limit
NUXT_TRUST_PROXY no false Set true behind a reverse proxy (reads X-Forwarded-For for rate limiting)
NUXT_COOKIE_SECURE no auto true when NODE_ENV=production, else false
NUXT_LOG_LEVEL no info pino level: fatal, error, warn, info, debug, trace
NUXT_METRICS_TOKEN no Bearer token enabling GET /metrics (Prometheus). Unset = endpoint returns 404; when set it must be >= 32 characters
NUXT_ADMIN_API_TOKENS_JSON no Bearer tokens for the provisioning API: [{"id":"importer","token":"..."}]. Unset or [] (and no <NUXT_APP_URL>/api resource server for service tokens) = every /api/provisioning/** route returns 404. Tokens must be >= 32 chars; id labels the caller in the audit log
NUXT_APP_ROLES_REQUIRE_GRANT no false Restrict PUT /api/apps/roles to users who already have an OIDC grant with the calling client (else 404)
NUXT_DEFAULT_LOCALE no en BCP-47 tag used when the user has no stored locale and no usable Accept-Language. Must be listed in NUXT_SUPPORTED_LOCALES.
NUXT_SUPPORTED_LOCALES no en Comma-separated BCP-47 tags offered in the account picker and accepted by the API. Locales outside this list are rejected with 400.
NUXT_EMAIL_LAYOUT_HTML no Overrides the HTML shell wrapping every email. Must contain {{slot}}.
NUXT_EMAIL_LAYOUT_TEXT no Overrides the plain-text shell wrapping every email. Must contain {{slot}}.
NUXT_EMAIL_VERIFICATION_SUBJECT / _BODY_HTML / _BODY_TEXT no Override the verification email's subject / HTML body fragment / text body fragment. See "Email templates" section.
NUXT_EMAIL_PASSWORD_RESET_SUBJECT / _BODY_HTML / _BODY_TEXT no Same, for the password-reset email.
NUXT_EMAIL_LOGIN_CODE_SUBJECT / _BODY_HTML / _BODY_TEXT no Same, for the 2FA login-code email.
NUXT_EMAIL_INVITE_SUBJECT / _BODY_HTML / _BODY_TEXT no Same, for the invite email sent to admin-created users.
NUXT_EMAIL_NEW_LOGIN_SUBJECT / _BODY_HTML / _BODY_TEXT no Same, for the new-sign-in alert (NUXT_SUSPICIOUS_LOGIN_ALERTS).
NUXT_DATABASE_POOL_MIN no Connections the PostgreSQL pool keeps open when idle (default 2). 0 lets an idle instance hold none, which is what you want when several instances share one cluster.
NUXT_DATABASE_POOL_MAX no Connections one instance may take at peak (default 10). max_connections is a server-wide budget: ten busy instances at this default exhaust a stock cluster, and Postgres then refuses connections for everyone.
NUXT_DATABASE_POOL_ACQUIRE_TIMEOUT_MS no 30000 How long a request waits for a free pool connection before failing, in milliseconds (default 30000, range 1000–600000).
NUXT_SESSION_MAX_AGE_MINUTES no How long a session lasts without activity (default 15).
NUXT_SESSION_REMEMBER_ME_MAX_AGE_DAYS no The same, for a login that ticked "remember me" (default 7 days). 1–365.
NUXT_APP_METADATA_ENABLED no false Enable the per-user app metadata store (GET/PATCH /api/apps/metadata) — a small key→value store an app reads and writes with its own client_secret.
NUXT_APP_METADATA_REQUIRE_GRANT no false Restrict the app metadata API to users who already have an OIDC grant with the calling client (else 404, uniform with an unknown user).
NUXT_APP_METADATA_AUDIT no false Record an oidc.client.metadata_updated audit row for every successful app metadata write (key names, never values).
NUXT_APP_METADATA_MAX_KEYS no 50 Most keys one user may hold in one metadata namespace (default 50, range 1–200).
NUXT_APP_METADATA_MAX_VALUE_BYTES no 4096 Longest single metadata value, in UTF-8 bytes (default 4096, range 1–16384).
NUXT_APP_METADATA_MAX_KEYS_PER_REQUEST no 25 Most keys one metadata PATCH may touch, upserts and deletes together (default 25, range 1–100).
NUXT_OIDC_CIMD_ALLOWED_HOSTS no Comma-separated hosts whose https:// URLs may act as client_id (Client ID Metadata Documents, IETF draft): the client describes itself in a JSON document at that URL instead of an entry in NUXT_OIDC_CLIENTS_JSON.
NUXT_OIDC_CIMD_ALLOWED_RESOURCES no Comma-separated resource audiences a self-described (CIMD) client may request with resource= — their allowedResources.
NUXT_WEBHOOK_RETRY_DELAYS_MS no Comma-separated backoff delays (ms) before each webhook re-attempt after the first.
NUXT_EMAIL_MAGIC_LINK_SUBJECT / _BODY_HTML / _BODY_TEXT no Same, for the sign-in link email.
NUXT_BOOTSTRAP_ADMIN_EMAIL no Create an admin with this address at startup if it has no account yet.
NUXT_BOOTSTRAP_ADMIN_PASSWORD no Password for the bootstrap admin.
NUXT_CAPTCHA_SECRET no The provider's secret key, used server-side to verify each submitted token.
NUXT_CAPTCHA_MIN_SCORE no 0.5 recaptcha-v3 only: the minimum score (0.0 bot … 1.0 human) a submission needs.
NUXT_AUDIT_LOG_RETENTION_DAYS no Delete audit-log rows older than N days (hourly sweep).

Public (NUXT_PUBLIC_*)

Variable Default Description
NUXT_PUBLIC_THEME_PRIMARY_COLOR #06d6a0 Primary color hex -- full palette auto-generated via HSL
NUXT_PUBLIC_THEME_BACKGROUND_COLOR #0a0e17 Page background hex
NUXT_PUBLIC_THEME_TEXT_COLOR #f1f5f9 Base text color hex
NUXT_PUBLIC_THEME_BORDER_RADIUS 12px Global border radius
NUXT_PUBLIC_THEME_LOGO_URL URL or path to logo image (app UI and, unless overridden, email)
NUXT_EMAIL_LOGO_URL Server-only email header logo; none = app name as text. Empty follows NUXT_PUBLIC_THEME_LOGO_URL
NUXT_PUBLIC_THEME_SURFACE_COLOR auto Card/surface background -- auto-derived from background color
NUXT_PUBLIC_THEME_SURFACE_SECONDARY_COLOR auto Secondary surface -- auto-derived from background color
NUXT_PUBLIC_THEME_BORDER_COLOR auto Border color -- auto-derived from background color
NUXT_PUBLIC_THEME_MUTED_COLOR auto Muted/secondary text -- auto-derived from background color
NUXT_PUBLIC_THEME_NAME Schleuse App name in UI and page titles
NUXT_PUBLIC_THEME_DARK_MODE true true or false
NUXT_PUBLIC_THEME_BACKGROUND_IMAGE URL or path to a background image for auth pages
NUXT_PUBLIC_THEME_BACKGROUND_LAYOUT split split (form left, image right) or full (fullscreen image behind form)
NUXT_PUBLIC_HOME_REDIRECT_URL Where visitors to / are redirected (internal path or http(s):// URL); unset: /login. Without OIDC clients / shows the setup guide
NUXT_PUBLIC_CUSTOM_DISPLAY_NAME false Allow users to set a custom display name (when false, auto-composed from first + last name)
NUXT_PUBLIC_CAPTCHA_PROVIDER CAPTCHA on sign-up (password, passkey and email link), forgot-password, resend-verification and magic-link sign-in: turnstile, recaptcha (v2 checkbox), recaptcha-v3 (score, invisible), hcaptcha, cap, or altcha (built in: no keys, no external service).
NUXT_PUBLIC_CAPTCHA_SITE_KEY The provider's public site key — rendered into the pages that show the CAPTCHA.
NUXT_PUBLIC_CAPTCHA_CAP_URL Cap only: base URL of your Cap Standalone instance, e.g. https://cap.example.com.
NUXT_PUBLIC_THEME_DARK_BACKGROUND_COLOR Dark variant of a light theme: page background.
NUXT_PUBLIC_THEME_DARK_TEXT_COLOR Dark variant: base text colour.
NUXT_PUBLIC_THEME_DARK_PRIMARY_COLOR Dark variant: primary colour.
NUXT_PUBLIC_THEME_DARK_SURFACE_COLOR Dark variant: card / surface background.
NUXT_PUBLIC_THEME_DARK_SURFACE_SECONDARY_COLOR Dark variant: secondary surface background.
NUXT_PUBLIC_THEME_DARK_BORDER_COLOR Dark variant: border colour.
NUXT_PUBLIC_THEME_DARK_MUTED_COLOR Dark variant: muted / secondary text colour.

JWT keys

Both NUXT_JWT_SECRET and NUXT_JWT_PRIVATE_KEY are auto-generated on first start when not set. Generated keys are persisted to the data/ directory:

File Contents Purpose
data/jwt-secret.txt 48-byte random base64url string HMAC signing for session JWTs
data/jwt-private-key.pem RSA 2048 PKCS8 PEM OIDC ID token signing (RS256)

Files are created with mode 0600 (owner read/write only). NUXT_DATA_DIR moves them to another directory (default: data/ under the working directory); it does not move a relative SQLite path.

Priority: ENV variable > persisted file > generate new

Mount /app/data as a Docker volume to persist keys across container restarts. If you want to bring your own keys, set the ENV variables and the files will not be created.

To generate keys manually:

# JWT secret (>= 32 chars)
node -e "console.log(require('crypto').randomBytes(32).toString('hex'))"

# RSA private key (newlines escaped for .env)
node -e "
  const {generateKeyPairSync} = require('crypto');
  const {privateKey} = generateKeyPairSync('rsa', {modulusLength: 2048});
  const pem = privateKey.export({type:'pkcs8',format:'pem'});
  console.log(pem.replace(/\n/g,'\\\\n'));
"

OIDC client configuration

NUXT_OIDC_CLIENTS_JSON is a JSON array of client objects:

[
  {
    "clientId": "my-app",
    "redirectUris": ["https://my-app.example.com/callback"],
    "grantTypes": ["authorization_code"],
    "scopes": ["openid", "email", "profile"],
    "public": true
  }
]
Field Description
clientId Unique client identifier
redirectUris Allowed callback URLs
grantTypes Must include authorization_code
scopes Subset of openid, email, profile, roles, offline_access
public true = no secret (SPAs/native apps). false = secret derived from sha256(NUXT_JWT_PRIVATE_KEY + clientId + secretVersion?)
clientSecret Optional (confidential, >= 16 chars). Explicit secret used verbatim, so several apps can be deployed reproducibly from one compose file. Takes precedence over the derived secret
secretVersion Optional. Rotation salt folded into the derived secret -- rotates only this client's secret
roles Optional. Role names this app defines. Returned in the roles claim when the client requests the roles scope
roleMode Optional (default multiple). single restricts each user to at most one role
roleGroup Optional. Clients sharing a group share a user's role assignment. Absent = the group is the clientId
loginRequiresRole / loginRequiredRoles Optional. Gate sign-in on holding any role / one of these specific roles
loginRequiresCredential Optional. Refuse magic-link sessions: only a password or passkey sign-in completes this app's authorization
backchannelLogoutUri Optional. Receives a signed logout_token when the user signs out
backchannelLogoutSessionRequired Optional (default false). Include a sid in the logout_token
postLogoutRedirectUris Optional. Allowed post_logout_redirect_uri targets for RP-initiated logout
allowedResources Optional. Restrict which JWT-AT resource audiences this client may request

Notifications are no longer a client field. webhookUrl was removed in 1.11; subscribe to account.deleted — or any of the 45 audit events — in NUXT_WEBHOOKS_JSON, which signs its deliveries and retries them. See Webhooks.

Full per-field semantics: https://schleuse.meowww.dev/guide/oidc.

Email templates

Six emails are sent by the server: verification, invite (admin-created users), password reset, login code (2FA), magic sign-in link, and the new-sign-in alert (only when NUXT_SUSPICIOUS_LOGIN_ALERTS is on). Each is rendered as subject + HTML body + plain-text body. All three pieces are overridable per email via env vars; a separate pair of layout vars wraps every email so you can rebrand the shell once and keep the built-in inner content.

Placeholders (replaced literally — unknown placeholders render as-is):

Placeholder Where Value
{{appName}} all NUXT_PUBLIC_THEME_NAME
{{primaryColor}} all NUXT_PUBLIC_THEME_PRIMARY_COLOR
{{logoUrl}} all NUXT_EMAIL_LOGO_URL, else NUXT_PUBLIC_THEME_LOGO_URL, made absolute (empty for none)
{{firstName}} body + layout the recipient's first name
{{url}} verification + invite + password-reset + new-sign-in bodies the action link (account page for new-sign-in)
{{code}} login-code body the 6-digit 2FA code
{{ip}} {{device}} {{when}} new-sign-in body IP, User-Agent and time of the flagged login ({{when}} in the recipient's language, UTC)
{{slot}} layout only the (already-substituted) body fragment

Resolution — for each field (subject / html body / text body / html layout / text layout) the matching env var wins; when unset, the built-in fallback applies. The four combinations all work: no overrides, body only, layout only, both.

# docker-compose.yml (excerpt) — custom layout + custom verification body
services:
  schleuse:
    environment:
      NUXT_EMAIL_LAYOUT_HTML: |
        <!doctype html>
        <html><body style="font-family:sans-serif">
        <main style="max-width:560px;margin:24px auto;padding:24px">
          {{slot}}
        </main>
        </body></html>
      NUXT_EMAIL_VERIFICATION_SUBJECT: "Confirm your {{appName}} account"
      NUXT_EMAIL_VERIFICATION_BODY_HTML: |
        <h2>Hi {{firstName}}!</h2>
        <p><a href="{{url}}">Confirm your email →</a></p>
      NUXT_EMAIL_VERIFICATION_BODY_TEXT: |
        Hi {{firstName}}, confirm your email: {{url}}

Layout vars must contain {{slot}}; the container exits at startup with a clear error otherwise.

Per-locale overrides: append _<LOCALE> (uppercased, region stripped) to any of the vars above. The loader prefers the suffixed var when a user's resolved locale matches, falling back to the unsuffixed var and finally the built-in template.

environment:
  NUXT_SUPPORTED_LOCALES: "en,de"
  NUXT_DEFAULT_LOCALE: "en"
  NUXT_EMAIL_VERIFICATION_SUBJECT_DE: "Bestätige dein Konto — {{appName}}"
  NUXT_EMAIL_VERIFICATION_BODY_TEXT_DE: |
    Hallo {{firstName}},
    bitte bestätige deine Email: {{url}}

Users pick their preferred locale on /account; registrations without an explicit locale in the request body derive it from the Accept-Language header, intersected with NUXT_SUPPORTED_LOCALES, with NUXT_DEFAULT_LOCALE as the final fallback.

Production SMTP examples

# SendGrid
NUXT_SMTP_HOST=smtp.sendgrid.net
NUXT_SMTP_PORT=587
NUXT_SMTP_USER=apikey
NUXT_SMTP_PASS=<api-key>

# Gmail (app password)
NUXT_SMTP_HOST=smtp.gmail.com
NUXT_SMTP_PORT=587
NUXT_SMTP_USER=you@gmail.com
NUXT_SMTP_PASS=<app-specific-password>

OIDC Usage

The built-in provider implements Authorization Code Flow with mandatory PKCE (S256).

Supported scopes and claims:

Scope Claims / Effect
openid sub
email email, email_verified
profile name, given_name, family_name, preferred_username
roles roles -- the user's per-application roles (clients that define roles)
offline_access Issues a refresh token (7-day lifetime, rotated on each use) that outlives the Schleuse session

Discovery

GET /.well-known/openid-configuration
GET /.well-known/jwks.json

Authorization flow

Step 1 -- Generate PKCE values

CODE_VERIFIER=$(openssl rand -base64 32 | tr -d '=' | tr '+/' '-_')
CODE_CHALLENGE=$(echo -n "$CODE_VERIFIER" | openssl dgst -sha256 -binary | base64 | tr -d '=' | tr '+/' '-_')
STATE=$(openssl rand -hex 8)

Step 2 -- Redirect user to authorize

GET /oidc/authorize
  ?client_id=my-app
  &redirect_uri=https://my-app.example.com/callback
  &response_type=code
  &scope=openid email profile
  &code_challenge=<CODE_CHALLENGE>
  &code_challenge_method=S256
  &state=<STATE>

The user sees the login page. After authentication, the provider redirects to redirect_uri with ?code=...&state=....

Step 3 -- Exchange code for tokens

curl -X POST https://your-domain.com/oidc/token \
  -d grant_type=authorization_code \
  -d client_id=my-app \
  -d redirect_uri=https://my-app.example.com/callback \
  -d code=AUTHORIZATION_CODE \
  -d code_verifier=$CODE_VERIFIER
{
  "access_token": "...",
  "id_token": "...",
  "token_type": "Bearer",
  "expires_in": 3600,
  "scope": "openid email profile"
}

Step 4 -- Fetch user info

curl -H "Authorization: Bearer <ACCESS_TOKEN>" \
  https://your-domain.com/oidc/userinfo
{
  "sub": "550e8400-e29b-41d4-a716-446655440000",
  "email": "user@example.com",
  "email_verified": true,
  "name": "Jane Doe"
}

Token introspection (RFC 7662)

Resource servers that want to validate a token against live state (rather than verifying the JWT signature locally) can call /oidc/introspect:

curl -X POST https://your-domain.com/oidc/introspect \
  -d client_id=my-app \
  -d token=<ACCESS_OR_REFRESH_TOKEN>

Confidential clients authenticate via HTTP Basic (-u client_id:secret) — the secret is derived as sha256(NUXT_JWT_PRIVATE_KEY + clientId). Public clients pass client_id in the body and can only introspect their own tokens.

Active token → { "active": true, "sub", "client_id", "scope", "exp", "iat", "iss", "token_type" }. Revoked or expired token → { "active": false } (per RFC 7662, no further details leaked). Missing auth → 400 invalid_request; wrong credentials → 401 invalid_client.

Token TTLs

Token Lifetime
Access token 1 hour
ID token 1 hour
Refresh token 7 days (rotated on each use); for a client without offline_access it ends with the Schleuse session
Authorization code 10 minutes
Session 24 hours
Grant 14 days

Interactive testing

pnpm test:oidc        # runs full authorize -> token -> userinfo flow in a browser
pnpm test:oidc:setup  # prints the client config to add to .env

API Reference

The complete, per-endpoint reference lives on the docs site: https://schleuse.meowww.dev/reference/api (source: website/reference/api.md). What follows is the working subset.

Health

Method Path Description
GET /api/health Liveness check ({ status: 'ok' })
GET /api/ready Readiness check (verifies database connection)
GET /metrics Prometheus text exposition. Requires Authorization: Bearer <NUXT_METRICS_TOKEN>; 404 when the token is unset

Authentication

Method Path Description
POST /api/auth/register Create account + send verification email
POST /api/auth/login Password login, sets httpOnly JWT cookie
POST /api/auth/logout Clear session cookie, fire OIDC back-channel logout to relying parties
GET /api/auth/verify-email?token=... Verify email address
POST /api/auth/resend-verification Resend verification email
POST /api/auth/password/forgot Request password reset link
POST /api/auth/magic-link Email a single-use sign-in link
POST /api/auth/magic-link/verify Redeem a sign-in link (sets auth cookie, or hands over to TOTP)
POST /api/auth/magic-link/signup Email a sign-up link (NUXT_MAGIC_LINK_SIGNUP_ENABLED); nothing is created yet
POST /api/auth/magic-link/signup/confirm Redeem a sign-up link: create the verified, credential-less account and sign in
POST /api/auth/password/reset Set new password using reset token
POST /api/auth/accept-invite Accept an admin invite: set the first password, activating + verifying the account. Single-use
POST /api/auth/send-2fa-code Send (or resend) the emailed 2FA code for a pending login
POST /api/auth/verify-login-code Complete 2FA login with the emailed 6-digit code
POST /api/auth/verify-totp Complete 2FA login with an authenticator code or a one-time backup code
POST /api/auth/verify-2fa-passkey/start | /finish Complete 2FA login with a registered passkey

Registration does not issue a session. The user must verify their email before logging in -- unless NUXT_SMTP_HOST is empty, in which case accounts are auto-verified.

Account Management

Requires authentication.

Method Path Description
GET /api/me Current user profile (incl. hasPassword, passkeyCount, locale)
PATCH /api/me Update name / display name / language
POST /api/me/password Change or set password (requires current password when one exists, invalidates other sessions)
POST /api/me/password-reauth Start passkey re-authentication for password removal
DELETE /api/me/password Go passwordless -- confirm with password or passkey assertion. Requires >= 1 passkey
GET /api/me/passkeys List registered passkeys
DELETE /api/me/passkeys/:id Remove a passkey. Blocked (403) when it is the last auth factor on a passwordless account
GET /api/me/totp TOTP status ({ enabled, backupCodesRemaining })
POST /api/me/totp/start | /confirm Enrol an authenticator app; confirm returns the one-time backup codes
POST /api/me/totp/backup-codes Regenerate backup codes (requires a current code)
DELETE /api/me/totp Disable TOTP (requires a current TOTP or backup code)
POST /api/me/sessions/revoke-others Sign out of all other devices
GET /api/me/sessions/last-revoked-others When "sign out other devices" was last used
GET /api/me/activity The user's own recent account activity
GET /api/me/referrer Validate a "back to the app" link against a client's redirect URIs
GET /api/me/export GDPR data-portability export (JSON download, no hashes or token values)
DELETE /api/me Delete account (requires password confirmation, notifies OIDC clients via webhook)

WebAuthn (Passkeys)

Passkeys can be added to any verified account as an alternative login method, or used to register outright.

Method Path Description
POST /api/webauthn/register/start | /finish Add a passkey to the signed-in account
POST /api/webauthn/login/start | /finish Passkey login, sets auth cookie
POST /api/webauthn/signup/start | /finish Create a new passwordless account with a passkey

OIDC

Method Path Description
GET /.well-known/openid-configuration Discovery document
GET /.well-known/jwks.json Public key set
GET /oidc/authorize Authorization endpoint
POST /oidc/token Token endpoint
GET /oidc/userinfo User info endpoint
GET /oidc/jwks JWKS endpoint (alternate)
GET /oidc/session/end End session
POST /oidc/revoke Token revocation (RFC 7009)
POST /oidc/introspect Token introspection (RFC 7662)
POST /api/oidc/interaction/:uid/finish Complete OIDC interaction (internal)

Admin

Requires an authenticated admin user. The first registered user is automatically promoted to admin (unless NUXT_AUTO_ADMIN_FIRST_USER=false).

Roughly two dozen endpoints under /api/admin/**, grouped as:

Group Endpoints
Dashboard stats
Users users (list, create), users/:id (get, patch, delete), suspend, unsuspend, force-logout, reset-two-factor, export
Roles users/:id/roles (get, put), roles/rekey
Audit audit-logs, audit-logs/anonymize-orphans
Incident response force-logout-all -- invalidates every session in one bulk update, keeping the acting admin signed in
Operator tooling config, integration, clients/:clientId/secret, email/status, email/preview, email/test

Query parameters for /api/admin/users: page, perPage (max 100), search (email/name), emailVerified (true/false), isAdmin (true/false)

Query parameters for /api/admin/audit-logs: page, perPage (max 100), event (event type), from (ISO date), to (ISO date)

Guards: admins cannot remove their own admin status or delete their own account via the admin panel. Per-endpoint semantics: https://schleuse.meowww.dev/reference/api#admin.

App API (server-to-server)

Authenticated by a confidential OIDC client's client_id + client_secret via HTTP Basic -- no session, no CSRF.

Method Path Description
GET /api/apps/roles Read the calling client's roles for a user (?userId= or ?email=)
PUT /api/apps/roles Set the calling client's roles for a user

The clientId comes from the authenticated credentials, never the body, so a client can only write its own app-roles; is_admin is never touched. Set NUXT_APP_ROLES_REQUIRE_GRANT=true to restrict writes to users who already have a grant with that client.

Provisioning API (server-to-server)

Bulk user creation / import for migrating an existing realm onto Schleuse. Authenticated by a bearer token -- a client_credentials service token for <NUXT_APP_URL>/api with scope schleuse:provisioning (recommended), or a static token from NUXT_ADMIN_API_TOKENS_JSON -- no session, no CSRF; a session cookie never satisfies these routes, even an admin's. No static tokens and no <NUXT_APP_URL>/api resource server means every route below returns 404.

Method Path Description
POST /api/provisioning/users Create one user, optionally returning an invite link
POST /api/provisioning/users/import Batch create (<= 500), supports dryRun
GET /api/provisioning/users/lookup Resolve ?legacySub= or ?email= to a user

Walkthrough with a Keycloak example: https://schleuse.meowww.dev/guide/migration.

CSRF

Method Path Description
GET /api/csrf-token Get CSRF token (also sets csrf_token cookie)

All POST/PUT/PATCH/DELETE requests require the X-CSRF-Token header (value from the cookie or response). OIDC endpoints are exempt (protected by PKCE/state), as are the bearer/Basic-authenticated App and Provisioning APIs. The token is rotated on login.


Development

pnpm install
docker compose up postgres mailcatcher -d
cp .env.example .env
pnpm dev

Scripts

Command Description
pnpm dev Dev server with HMR
pnpm build Production build to .output/
pnpm preview Preview production build
pnpm test Run tests (single run)
pnpm test:watch Run tests in watch mode
pnpm test:oidc Interactive OIDC flow test
pnpm db:migrate Run pending migrations
pnpm db:migrate:rollback Rollback last batch (development only: on an install migrated in one go, that batch is the whole schema)
pnpm db:migrate:status Show migration status
pnpm db:migrate:make <name> Create a new migration

Testing

Tests use vitest and cover validation schemas, JWT security, CSRF tokens, rate limiting, OIDC adapter, and error handling. No database required -- all external dependencies are mocked.

Database

Migrations run automatically at startup via server/plugins/migrate.ts.

users
  id, email (unique), first_name, last_name, display_name,
  email_verified, is_admin, token_version, locale, suspended_at,
  legacy_sub (unique), invite_version, created_at, updated_at

password_credentials     (1:1 with users, cascade delete)
  user_id, password_hash, created_at, updated_at

password_history         (N:1 with users, cascade delete)
  id, user_id, password_hash, created_at
  -- last N hashes for NUXT_PASSWORD_HISTORY_COUNT reuse checks

webauthn_credentials     (N:1 with users, cascade delete)
  id (credential id), user_id, public_key, counter,
  transports (jsonb), created_at, updated_at

totp_credentials         (1:1 with users, cascade delete)
  user_id, secret_encrypted, pending_secret_encrypted,
  confirmed_at, last_used_step, backup_codes, created_at, updated_at
  -- secrets encrypted at rest with NUXT_TOTP_ENCRYPTION_KEY

user_roles               (N:1 with users, cascade delete)
  user_id, role_group, role, created_at
  -- PK (user_id, role_group, role); app-managed roles per OIDC client

oidc_tokens              (oidc-provider persistent store)
  id, type, payload (jsonb), grant_id, user_code, uid,
  expires_at, consumed_at, created_at

audit_log                (persistent security event log)
  id, created_at, event, status, user_id, email,
  ip, user_agent, reason, request_id

email_codes              (2FA login verification codes)
  id, user_id, code, expires_at, used_at, created_at

Project structure

server/
  api/
    admin/             user management, audit logs, stats (admin only)
    auth/              register, login, logout, verify-email, password reset
    me/                profile, password, passkeys, TOTP, sessions, export
    webauthn/          register / login / signup (start+finish)
    apps/              app-roles API (OIDC client credentials)
    provisioning/      bulk user create/import/lookup (bearer token)
    oidc/interaction/  OIDC interaction finish
    csrf-token.get.ts
    health.get.ts
    ready.get.ts
  db/
    migrations/        versioned Knex migrations
    repositories/      user, password-credential, password-history,
                       webauthn-credential, totp-credential, user-role
  middleware/
    auth.ts            JWT cookie verification + CSRF validation
    logging.ts         request logging with correlation IDs
    security-headers.ts
  oidc/
    provider.ts        oidc-provider config (JWKS, clients, PKCE, findAccount)
    adapter.ts         Knex-backed token store for oidc-provider (Postgres + SQLite)
  plugins/
    migrate.ts         auto-run migrations at startup
  routes/
    oidc/[...].ts      catch-all proxy to oidc-provider
    .well-known/       openid-configuration, jwks.json
    metrics.get.ts     Prometheus exposition (bearer-gated, 404 when unconfigured)
  services/            email, token, webauthn, totp, two-factor, audit, provisioning
  utils/               cookies, csrf, env, errors, jwt, logger, rate-limit, validation

app/                     Nuxt 4 srcDir -- all client-side code lives here
  pages/
    login.vue            password + passkey login
    verify-login.vue     second-factor challenge (TOTP / passkey / email code)
    setup-2fa.vue        enforced 2FA enrolment
    register.vue         account creation
    accept-invite.vue    invited-user onboarding
    forgot-password.vue  request reset link
    reset-password.vue   set new password
    account.vue          self-service account management
    admin/               admin panel (dashboard, users, audit logs)
  components/            Auth* (Card, Input, Button, Heading, Alert), Account* modals
  composables/           useTheme (runtime CSS variables), useCsrf, useI18n, useTotp
  layouts/               auth (centered card), account, admin (sidebar navigation)
  middleware/            auth, admin route guards
  plugins/               i18n, autofocus
  i18n/                  UI locale catalogues (en, de)
  utils/                 client-side validation + config helpers

Production Deployment

pnpm build
node .output/server/index.mjs

The .output/ directory is self-contained. Or use Docker with the pre-built registry image:

docker compose pull
docker compose up -d

Checklist

  • NUXT_ISSUER / NUXT_APP_URL / NUXT_RP_ORIGIN -- set to real domain
  • NODE_ENV=production -- enables secure cookies and HSTS
  • NUXT_TRUST_PROXY=true -- if behind nginx/Caddy/ALB
  • /app/data volume mounted -- persists auto-generated JWT + TOTP keys (and SQLite DB if used)
  • data/totp-encryption-key.txt included in backups -- losing it forces every user to re-enrol TOTP
  • NUXT_SMTP_* -- real mail provider (optional; without it, email verification, email 2FA and password reset are unavailable)
  • NUXT_METRICS_TOKEN -- if you scrape /metrics; keep the endpoint on the private network
  • NUXT_ADMIN_API_TOKENS_JSON -- only if you need the provisioning API; leave unset to keep it 404
  • HTTPS/TLS on the reverse proxy
  • Database backups configured (PostgreSQL) or file-level backup (SQLite + data/ volume)

Security Notes

Password handling

  • argon2id with OWASP-recommended parameters (m=65536, t=3, p=4)
  • Passwords are never logged or returned in API responses
  • Password fields are redacted in all structured log output

Token handling

Token Storage Lifetime Invalidation
Session (auth) httpOnly cookie 15 min (7 days with "Remember me") Logout clears cookie; password change invalidates all other sessions via token version. Sliding: auto-renewed after 50% of lifetime.
Email verification Signed JWT (URL) 24 hours Verifies once; signs in only on the click that verified, inside a pending app sign-in
Password reset Signed JWT (URL) 1 hour Embeds current password hash -- invalidated on password change
WebAuthn challenge Signed JWT 5 min Expires naturally
OIDC access token Bearer token 1 hour Grant revocation

Session cookies: httpOnly=true, secure=true (production), sameSite=lax, path=/.

CSRF protection

Double-submit cookie pattern with constant-time comparison. Required on all state-changing requests. OIDC endpoints are exempt (use PKCE + state).

Rate limiting

Endpoint Default ENV override
Login 10 / 15 min NUXT_RATE_LIMIT_LOGIN
Registration 10 / 60 min NUXT_RATE_LIMIT_REGISTER
Password reset 5 / 60 min NUXT_RATE_LIMIT_PASSWORD_RESET

Per-IP counters (requires NUXT_TRUST_PROXY=true behind a reverse proxy). Retry-After header sent when limit is exceeded. Configurable via ENV vars (maxAttempts/windowMinutes format). In-memory store — resets on restart, which is acceptable for the single-instance sidecar deployment model.

Security headers

  • Strict-Transport-Security: max-age=31536000 (HTTPS only; NUXT_HSTS=include-subdomains or preload adds the directives — set it there, not at the proxy)
  • X-Content-Type-Options: nosniff
  • X-Frame-Options: DENY
  • Referrer-Policy: strict-origin-when-cross-origin

OIDC

  • Authorization Code Flow only (no implicit or hybrid)
  • PKCE mandatory, S256 only (plain rejected)
  • Refresh tokens via offline_access scope — rotated on every use (one-time)
  • Token revocation endpoint (/oidc/revoke) enabled per RFC 7009
  • JWKS derived from RSA private key with RFC 7638 thumbprint for stable kid

Logging

  • Structured JSON via pino (pretty-printed in development)
  • Correlation IDs via X-Request-Id header (generated if not present)
  • Sensitive fields (password, token, secret, authorization, cookie) redacted automatically
  • Quiet paths (/_nuxt/, /__nuxt, /api/health) logged at debug level

Troubleshooting

"Environment validation failed" at startup
Check which variables are missing. JWT keys are auto-generated, but NUXT_DATABASE_URL, NUXT_ISSUER, NUXT_APP_URL, NUXT_RP_*, and NUXT_OIDC_CLIENTS_JSON must be set. See Configuration.
JWT keys not auto-generated
Ensure /app/data is writable. In Docker, mount it as a volume. The container runs as user app -- the directory must be owned by that user (the Dockerfile handles this).
OIDC discovery shows wrong URLs
NUXT_ISSUER must end with /oidc (e.g. http://localhost:3000/oidc).
OIDC /userinfo returns 401
Behind a TLS-terminating proxy, set NUXT_TRUST_PROXY=true. Without it, oidc-provider emits http:// URLs in discovery. The http->https redirect strips the Authorization header per the Fetch spec.
invalid_client_metadata: scope must only contain AS supported scope values
Client scopes in NUXT_OIDC_CLIENTS_JSON must be a subset of openid, email, profile, roles, offline_access.
OIDC cookies not set in development
NODE_ENV must NOT be production when running over plain HTTP. The provider's secure cookie flag is gated on NODE_ENV=production.
Migration fails: "missing files"
Do not rename migration files after they have been applied. The filenames in knex_migrations must match the files on disk.
WebAuthn: "No passkeys found"
Register a passkey first via /api/webauthn/register/start while logged in.
WebAuthn: "Challenge expired"
The challenge JWT has a 5-minute window. Complete the browser prompt within that time.
argon2 binary not found in Docker
Rebuild the image: docker compose build --no-cache.
Port conflict
Set PORT=3001 in .env and update the port mapping in docker-compose.yml.