Modern auth for people and AI agents. Agents get their own account, owner and signed permissions.
257
Dopgate is an auth server for one app, made by Dopbase. It signs users up and in, confirms their email with 6-digit codes, resets passwords, and gives AI agents accounts of their own. Every access token is an ES256 JWT that says whether a person or an agent is calling, and your backend verifies it offline against a public key set.
Dopgate runs in your infrastructure as one container next to your app. It keeps every table in a PostgreSQL schema (dopgate by default), so it can share your app's database.
latest, and for every release its version and its minor line, such as 0.1.0 and 0.1linux/amd64 and linux/arm648850kind: agent, its owner, and the capabilities the owner gave it./.well-known/jwks.json./.Single sign-on and multi-factor authentication are planned and are not in this image yet. Product status lists what works today.
Save this as compose.yaml, and change the password and the root email:
services:
postgres:
image: postgres:18-alpine
restart: unless-stopped
environment:
POSTGRES_DB: app
POSTGRES_USER: app
POSTGRES_PASSWORD: change-me
volumes:
- pgdata:/var/lib/postgresql
healthcheck:
test: ["CMD-SHELL", "pg_isready -U app -d app"]
interval: 5s
timeout: 3s
retries: 10
dopgate:
image: dopbase/dopgate
restart: unless-stopped
depends_on:
postgres:
condition: service_healthy
environment:
DOPGATE_DATABASE_URL: postgres://app:change-me@postgres:5432/app
DOPGATE_PUBLIC_URL: http://localhost:8850
DOPGATE_ROOT_EMAIL: [email protected]
ports:
- "8850:8850"
volumes:
pgdata:
Then start it and read the log:
docker compose up -d
docker compose logs dopgate
The log shows the root password once. Open http://localhost:8850, sign in with the root email and that password, and change the password on the Account page. The API is at http://localhost:8850/api/v1.
Without SMTP settings, Dopgate writes every email, codes included, to its log. For anything you keep running, pin a version such as dopbase/dopgate:0.1 in place of latest.
docker run -d --name dopgate -p 8850:8850 \
-e DOPGATE_DATABASE_URL=postgres://user:[email protected]:5432/app \
-e DOPGATE_PUBLIC_URL=https://auth.example.com \
-e [email protected] \
dopbase/dopgate
On startup Dopgate waits up to 30 seconds for PostgreSQL, creates its schema if needed, runs migrations, and generates a signing key on a fresh database. Read the root password with docker logs dopgate.
Always set DOPGATE_PUBLIC_URL. It becomes the iss claim of every access token, so your backend's issuer check fails when it is wrong.
| Variable | What it does |
|---|---|
DOPGATE_DATABASE_URL | PostgreSQL URL. Required. |
DOPGATE_PUBLIC_URL | The URL your app and users reach Dopgate on, and the issuer of every access token. |
DOPGATE_ROOT_EMAIL | On a database without a root account, creates root for this email and prints a generated password once. |
DOPGATE_ALLOWED_ORIGINS | Browser origins allowed to call the API, comma-separated, such as https://app.example.com. |
DOPGATE_SERVICE_KEY | Bearer token your backend uses for the admin API. At least 32 characters. |
DOPGATE_TRUSTED_PROXIES | Addresses or CIDR ranges of reverse proxies whose X-Forwarded-For is trusted. |
DOPGATE_DATABASE_SCHEMA | Schema for every Dopgate table. dopgate by default. |
DOPGATE_SMTP_URL | The SMTP server, as smtp://username:password@host:587. Unset leaves SMTP to the console, or sends emails to the log. |
DOPGATE_DOCS | Set to true to serve Swagger UI at /api/docs. |
The environment variable reference has the full list with defaults.
The entrypoint is the dopgate binary, so anything after the image name is a Dopgate command:
# Create the root account interactively instead of using DOPGATE_ROOT_EMAIL
docker run --rm -it -e DOPGATE_DATABASE_URL=postgres://... dopbase/dopgate init
# Rotate the key that signs access tokens
docker run --rm -e DOPGATE_DATABASE_URL=postgres://... dopbase/dopgate keys rotate
# Set a new password for root or an admin who lost theirs
docker run --rm -e DOPGATE_DATABASE_URL=postgres://... dopbase/dopgate admin reset-password [email protected]
In a Compose stack, docker compose run --rm dopgate init does the same with the service's own settings.
nonroot user.dopgate healthcheck, that runs every 15 seconds.Dopgate stops on SIGTERM: it finishes the requests in flight and closes its database connections.
Apache-2.0. See LICENSE.
docker pull dopbase/dopgate:latest