Skip to content

Install

  • Docker 24+ with Compose v2
  • 512 MB of RAM for the auth container, plus whatever Postgres needs
  • A hostname that browsers can reach — a LAN IP is fine for evaluation, a domain is required for cookies to be shared with your app (see Embedding)
Terminal window
git clone https://github.com/TariqJandaly/ownauth.git
cd ownauth/docker
cp .env.example .env

The three values that must be set:

docker/.env
# openssl rand -base64 32
BETTER_AUTH_SECRET=
# The public origin of this instance. Everything the browser is told to call.
BASE_URL=https://auth.example.com
# Generates the database password. Change it from the default.
POSTGRES_PASSWORD=

TRUSTED_ORIGINS is the list of browser origins allowed to call the API. Add your app:

TRUSTED_ORIGINS=https://app.example.com,https://auth.example.com

Exact origins only — no wildcards, no trailing slashes, no *.example.com.

Terminal window
docker compose up -d
docker compose ps # both services should report healthy
curl -s localhost:3000/api/health

The first boot runs the schema migrations under a Postgres advisory lock, creates the ops tables in ownauth.*, and fingerprints the secret. That takes a few seconds; the health check has a 30 second grace period for exactly this reason.

Open BASE_URL in a browser. An instance with no accounts redirects to /setup, where the first account becomes the administrator. See First run.

Node 22 and pnpm 10:

Terminal window
pnpm install
pnpm --filter @ownauth/auth-service registry:build
pnpm --filter @ownauth/auth-service dev # http://localhost:3000

DATABASE_URL and CONFIG_PATH are read from the environment; the config file is at config/auth.config.yaml.

Path What
/setup first-run administrator creation; 404s once a user exists
/admin the console
/api/auth/* the auth API
/api/auth/jwks public keys for JWT verification
/api/openapi.json the generated API document
/r/<name>.json registry items for shadcn add
/api/health container health