> ## Documentation Index
> Fetch the complete documentation index at: https://docs.levelrail.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Self-host SuperTokens with Docker

> A self-hosted authentication backend with session management, social login, and passwordless, backed by Postgres.

A self-hosted authentication backend with session management, social login, and passwordless, backed by Postgres.

This page describes the Levelrail template for SuperTokens (Security). It deploys the services below as one Docker Compose app on your own server. Project site: [https://supertokens.com/docs/](https://supertokens.com/docs/).

Recommended memory: about 256 MiB.

## Services, ports and volumes

| Service | Image | Container ports | Volumes |
| - | - | - | - |
| `postgres` | `postgres:16-alpine` | none | `supertokens_postgres_data -&#62; /var/lib/postgresql/data` |
| `supertokens` | `registry.supertokens.io/supertokens/supertokens-postgresql:latest` | 3567 | none |

## Environment variables

| Service | Variable | Value |
| - | - | - |
| `postgres` | `POSTGRES_DB` | Preset in the template |
| `postgres` | `POSTGRES_PASSWORD` | Generated at deploy |
| `postgres` | `POSTGRES_USER` | Preset in the template |
| `supertokens` | `API_KEYS` | Preset in the template |
| `supertokens` | `POSTGRESQL_CONNECTION_URI` | Generated at deploy |

Passwords and keys marked as generated are created for you when the app is deployed and stored as secrets. Values are not shown here.

## Deploy SuperTokens with Levelrail

In the dashboard, open **Apps**, choose **New app**, then **Browse templates**, and select SuperTokens. Review the Compose body and deploy.

With the CLI:

```bash theme={"dark"}
levelrail-cli templates deploy supertokens --name my-supertokens
```

See the [service template catalog](/templates-and-registry) for how templates work, and [Getting started](/getting-started) if you have not installed Levelrail yet.

## More Security templates

* [2FAuth](/self-host/2fauth)
* [authentik](/self-host/authentik)
* [Cap](/self-host/cap-captcha)
* [Cryptgeon](/self-host/cryptgeon)
* [Infisical](/self-host/infisical)

All templates are listed in the [self-host gallery](/self-host).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.