Skip to content
Merged
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
21 changes: 18 additions & 3 deletions docs/deployment/self-host-supertokens.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
To deploy the Core Service you must configure two things: the actual API and the database.
- The core service can be deployed using a **Docker** image or directly inside your VM.
- The supported database is **PostgreSQL**. The minimum required version is `13.0`.
- The core service is a **trusted backend component**. Deploy it on a private network reachable only by your backend, and never expose it directly to the public internet or to your frontend. When it must be reachable more widely, protect it with an [API key](/docs/platform-configuration/supertokens-core/api-keys). See [Secure the core](#secure-the-core) for details.

:::info
**SuperTokens Core** has dropped **MySQL** and **MongoDB** support with the `11.0.0` release.
Expand Down Expand Up @@ -216,9 +217,12 @@
</BackendTabs.TabItem>
</BackendTabs>

:::info Security
No API key exists by default.
Check [the API keys documentation](/docs/platform-configuration/supertokens-core/api-keys) to see how to add one.
:::caution Security
The SuperTokens Core is a backend service, meant to be accessed only by your own backend through the backend SDKs. It must **not** be exposed directly to the public internet, to your frontend, or to end users. Any caller that can reach the Core can perform administrative operations on your users' data.

Check warning on line 221 in docs/deployment/self-host-supertokens.mdx

View workflow job for this annotation

GitHub Actions / vale-lint

[vale] reported by reviewdog 🐶 [SuperTokens.passive] 'be exposed' looks like passive voice. Raw Output: {"message": "[SuperTokens.passive] 'be exposed' looks like passive voice.", "location": {"path": "docs/deployment/self-host-supertokens.mdx", "range": {"start": {"line": 221, "column": 132}}}, "severity": "INFO"}

Check warning on line 221 in docs/deployment/self-host-supertokens.mdx

View workflow job for this annotation

GitHub Actions / vale-lint

[vale] reported by reviewdog 🐶 [SuperTokens.passive] 'be accessed' looks like passive voice. Raw Output: {"message": "[SuperTokens.passive] 'be accessed' looks like passive voice.", "location": {"path": "docs/deployment/self-host-supertokens.mdx", "range": {"start": {"line": 221, "column": 53}}}, "severity": "INFO"}

- **No API key exists by default.** Whenever the Core is reachable by anything other than your backend, protect it with an [API key](/docs/platform-configuration/supertokens-core/api-keys).
- **Prefer network isolation.** Deploy the Core on a private network (for example a VPC or an internal subnet) reachable only by your backend.

Check failure on line 224 in docs/deployment/self-host-supertokens.mdx

View workflow job for this annotation

GitHub Actions / vale-lint

[vale] reported by reviewdog 🐶 [SuperTokens.spelling] This word is not recognized: 'subnet' Raw Output: {"message": "[SuperTokens.spelling] This word is not recognized: 'subnet'", "location": {"path": "docs/deployment/self-host-supertokens.mdx", "range": {"start": {"line": 224, "column": 104}}}, "severity": "ERROR"}

Check warning on line 224 in docs/deployment/self-host-supertokens.mdx

View workflow job for this annotation

GitHub Actions / vale-lint

[vale] reported by reviewdog 🐶 [SuperTokens.acronyms] 'VPC' has no definition. Raw Output: {"message": "[SuperTokens.acronyms] 'VPC' has no definition.", "location": {"path": "docs/deployment/self-host-supertokens.mdx", "range": {"start": {"line": 224, "column": 85}}}, "severity": "INFO"}
- **Add further controls as needed:** restrict access by [IP address](/docs/platform-configuration/supertokens-core/ip-allow-deny) and serve traffic over [TLS/SSL](/docs/platform-configuration/supertokens-core/add-ssl-via-nginx).

Check warning on line 225 in docs/deployment/self-host-supertokens.mdx

View workflow job for this annotation

GitHub Actions / vale-lint

[vale] reported by reviewdog 🐶 [SuperTokens.acronyms] 'TLS' has no definition. Raw Output: {"message": "[SuperTokens.acronyms] 'TLS' has no definition.", "location": {"path": "docs/deployment/self-host-supertokens.mdx", "range": {"start": {"line": 225, "column": 156}}}, "severity": "INFO"}
:::

### 4. Set up the database
Expand Down Expand Up @@ -961,6 +965,17 @@

```

## Secure the core

The SuperTokens Core exposes administrative operations over its API — creating and updating users, issuing password-reset and passwordless codes, managing tenants, and more. By design these are available to the connecting backend, because the Core has no direct channel to your frontend and relies on your backend to mediate every request and to deliver codes and tokens to end users.

Check warning on line 970 in docs/deployment/self-host-supertokens.mdx

View workflow job for this annotation

GitHub Actions / vale-lint

[vale] reported by reviewdog 🐶 [SuperTokens.sentence-length] Break up long sentences for readability. Keep paragraphs short. Raw Output: {"message": "[SuperTokens.sentence-length] Break up long sentences for readability. Keep paragraphs short.", "location": {"path": "docs/deployment/self-host-supertokens.mdx", "range": {"start": {"line": 970, "column": 175}}}, "severity": "INFO"}

This trust model means the Core must be treated like your database: reachable only by your own backend, never by untrusted clients.

Check failure on line 972 in docs/deployment/self-host-supertokens.mdx

View workflow job for this annotation

GitHub Actions / vale-lint

[vale] reported by reviewdog 🐶 [SuperTokens.spelling] This word is not recognized: 'untrusted' Raw Output: {"message": "[SuperTokens.spelling] This word is not recognized: 'untrusted'", "location": {"path": "docs/deployment/self-host-supertokens.mdx", "range": {"start": {"line": 972, "column": 114}}}, "severity": "ERROR"}

Check warning on line 972 in docs/deployment/self-host-supertokens.mdx

View workflow job for this annotation

GitHub Actions / vale-lint

[vale] reported by reviewdog 🐶 [SuperTokens.passive] 'be treated' looks like passive voice. Raw Output: {"message": "[SuperTokens.passive] 'be treated' looks like passive voice.", "location": {"path": "docs/deployment/self-host-supertokens.mdx", "range": {"start": {"line": 972, "column": 38}}}, "severity": "INFO"}

- **Isolate the network.** Run the Core on a private network or subnet that only your backend can reach. This is the primary protection and applies regardless of any other setting.

Check failure on line 974 in docs/deployment/self-host-supertokens.mdx

View workflow job for this annotation

GitHub Actions / vale-lint

[vale] reported by reviewdog 🐶 [SuperTokens.spelling] This word is not recognized: 'subnet' Raw Output: {"message": "[SuperTokens.spelling] This word is not recognized: 'subnet'", "location": {"path": "docs/deployment/self-host-supertokens.mdx", "range": {"start": {"line": 974, "column": 65}}}, "severity": "ERROR"}
- **Set an API key.** If the Core can be reached by anything beyond your backend, configure an [API key](/docs/platform-configuration/supertokens-core/api-keys). Note that within a single deployment all callers share the same key; an API key is therefore not a substitute for network isolation between tenants.

Check warning on line 975 in docs/deployment/self-host-supertokens.mdx

View workflow job for this annotation

GitHub Actions / vale-lint

[vale] reported by reviewdog 🐶 [SuperTokens.passive] 'be reached' looks like passive voice. Raw Output: {"message": "[SuperTokens.passive] 'be reached' looks like passive voice.", "location": {"path": "docs/deployment/self-host-supertokens.mdx", "range": {"start": {"line": 975, "column": 39}}}, "severity": "INFO"}
- **Restrict by IP and use TLS.** Optionally limit access by [IP address](/docs/platform-configuration/supertokens-core/ip-allow-deny) and terminate [TLS/SSL](/docs/platform-configuration/supertokens-core/add-ssl-via-nginx) in front of the Core.

Check warning on line 976 in docs/deployment/self-host-supertokens.mdx

View workflow job for this annotation

GitHub Actions / vale-lint

[vale] reported by reviewdog 🐶 [SuperTokens.acronyms] 'TLS' has no definition. Raw Output: {"message": "[SuperTokens.acronyms] 'TLS' has no definition.", "location": {"path": "docs/deployment/self-host-supertokens.mdx", "range": {"start": {"line": 976, "column": 151}}}, "severity": "INFO"}

Check warning on line 976 in docs/deployment/self-host-supertokens.mdx

View workflow job for this annotation

GitHub Actions / vale-lint

[vale] reported by reviewdog 🐶 [SuperTokens.acronyms] 'TLS' has no definition. Raw Output: {"message": "[SuperTokens.acronyms] 'TLS' has no definition.", "location": {"path": "docs/deployment/self-host-supertokens.mdx", "range": {"start": {"line": 976, "column": 28}}}, "severity": "INFO"}
- **Enforce tenant scoping in your backend.** Sessions and other objects carry their tenant as a signed claim. When an action is restricted to a specific tenant, verify the tenant in your backend rather than relying on the URL the request arrived on.

## References

### Docker compose file
Expand Down
4 changes: 4 additions & 0 deletions docs/platform-configuration/supertokens-core/api-keys.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ The backend SDK uses API keys to authenticate requests to the SuperTokens core.

By default, there is no API key required. If you add an API key to the core's configuration or use the managed service, you need to add it to your backend SDK code. Otherwise, the core throws a `401` error.

:::caution
Running without an API key is only safe when the Core is on a private network reachable exclusively by your backend. If the Core can be reached from anywhere else, configure an API key — and ideally also restrict access by [IP address](/docs/platform-configuration/supertokens-core/ip-allow-deny) and serve traffic over [TLS/SSL](/docs/platform-configuration/supertokens-core/add-ssl-via-nginx). Any caller that can reach the Core can perform administrative operations on your users' data. See [Secure the core](/docs/deployment/self-host-supertokens#secure-the-core).
:::

## Before you start

:::caution no-title
Expand Down
1 change: 1 addition & 0 deletions docs/quickstart/introduction.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ You can check the following diagram for a high level overview of how the service

- You can also host the **SuperTokens Core** yourself. In that case your backend will communicate with a service that exists inside your infrastructure.
- If you are using a backend for which we do not have an SDK, you will have to spin up an additional auth service in a language for which we do have a backend SDK (NodeJS, Python or Golang).
- The **SuperTokens Core** is a trusted backend component. It should only be reachable by your backend, never exposed directly to the public internet or your frontend. When self-hosting, see [Secure the core](/docs/deployment/self-host-supertokens#secure-the-core).
:::

### Recipes
Expand Down
Loading