Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions blueprints/supertokens/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# SuperTokens

Runs the [SuperTokens](https://supertokens.com) core — the open-source
authentication engine behind sign-up, sign-in, sessions, password reset
and MFA. It is an **API-only service**: there is no dashboard to open.
Your own backend (using a SuperTokens SDK) talks to this core over HTTP,
and your frontend talks to your backend. The template deploys the
official PostgreSQL-backed core image with its own PostgreSQL service,
and exposes the core on your Dokploy domain (it listens on port 3567
internally).

Tested on Dokploy: deployed live and verified — the core answered over
HTTPS on the Dokploy domain and its health endpoint returned `Hello`.

## First run

1. Check the core is alive: open `https://<your-domain>/hello` — it
replies with the plain text `Hello`.
2. In your app's backend, initialize the SuperTokens SDK with
`connectionURI` set to your Dokploy domain (for self-hosted cores you
also set an API key — see the note below) and pick a recipe
(EmailPassword, Passwordless, ThirdParty, ...).
3. Users, sessions and tokens are then managed entirely through your
app; the core stores them in the bundled PostgreSQL.

## Configuration notes

- This template follows SuperTokens' self-hosting guide, which pairs the
core with its own PostgreSQL database (the
`supertokens-postgresql` image variant).
- For production, SuperTokens recommends protecting the core with an API
key: generate one, set it as the `API_KEYS` environment variable on the
`supertokens` service, and pass the same key from your backend SDK.
The key is deliberately not pre-generated here, because it must match
the value in your own backend's configuration.

## Secrets & data

The PostgreSQL password is generated automatically at deploy time (see
`template.toml`) and is shared by the database and the core's connection
URI. All auth data lives in the `pg-data` volume and survives redeploys.
29 changes: 29 additions & 0 deletions blueprints/supertokens/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
services:
supertokens:
image: registry.supertokens.io/supertokens/supertokens-postgresql:12.5.1
restart: unless-stopped
expose:
- "3567"
environment:
- POSTGRESQL_CONNECTION_URI=postgresql://supertokens:${DB_PASSWORD}@postgres:5432/supertokens
depends_on:
postgres:
condition: service_healthy

postgres:
image: postgres:16-alpine
restart: unless-stopped
environment:
- POSTGRES_USER=supertokens
- POSTGRES_PASSWORD=${DB_PASSWORD}
- POSTGRES_DB=supertokens
volumes:
- pg-data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U supertokens -d supertokens"]
interval: 5s
timeout: 5s
retries: 20

volumes:
pg-data: {}
1 change: 1 addition & 0 deletions blueprints/supertokens/meta.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"description":"SuperTokens is an open-source authentication core — sign-up, sign-in, sessions, password reset and MFA — that your own backend talks to over HTTP, with ready-made recipes and SDKs.","id":"supertokens","links":{"docs":"https://supertokens.com/docs","github":"https://github.com/supertokens/supertokens-core","website":"https://supertokens.com"},"logo":"supertokens.png","name":"SuperTokens","newConfig":true,"seoDescription":"Self-hosted open-source authentication core with sessions and MFA. Deploy SuperTokens with Docker Compose on Dokploy in minutes – free, open source, self-hosted.","seoTitle":"SuperTokens Docker Compose Setup","tags":["auth","security"],"version":"12.5.1"}
Binary file added blueprints/supertokens/supertokens.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 14 additions & 0 deletions blueprints/supertokens/template.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[variables]
main_domain = "${domain}"
db_password = "${password:32}"

[config]
env = [
"DB_PASSWORD=${db_password}",
]
mounts = []

[[config.domains]]
serviceName = "supertokens"
port = 3567
host = "${main_domain}"
Loading