---
title: Deploy SuperTokens with AI on Blossom
url: "/deploy/supertokens/"
canonical_url: https://blossom88.com/deploy/supertokens/
markdown_url: https://blossom88.com/deploy/supertokens.md
summary: Add email and password sign-in to a sample app with private SuperTokens Core
  and PostgreSQL.
categories:
- deployment
- security
stack:
- Java
- Node.js
- Express
- PostgreSQL
---

# Deploy SuperTokens with AI on Blossom

[SuperTokens](https://supertokens.com/) adds sign-in and session management
to your app. This recipe uses its free email and password flow with a small
Express app and a private SuperTokens Core Service.

## Ask Your Agent

> **Ask your AI agent:** Deploy SuperTokens on Blossom and help me add sign-in to a sample app.
>
> Follow this guide: https://blossom88.com/deploy/supertokens/

[Install the Blossom CLI and skill](https://docs.blossom88.com/learn/getting-started/install/) on your agent's machine and [choose a Location in your cloud account](https://docs.blossom88.com/learn/getting-started/choose-your-cloud/#connect-your-provider).

## Have Ready

- **Backend app** (Required): Use the SuperTokens backend SDK in your app or create a small Express app to try the workflow.
- **Private Core API key** (Required): Generate one key for Core and the trusted backend. Keep it out of browser code.

## How It Runs

| Part | Role | Where |
|---|---|---|
| Express app | Serve the sample page and handle requests with the backend SDK | App Capacity with HTTPS |
| SuperTokens Core | Manage accounts and sessions | Private Service on App Capacity |
| PostgreSQL | Keep account records and session state | Managed by Blossom |

## Deploy SuperTokens

Start PostgreSQL and link it to Core. Keep Core private and call it from your
backend with an API key. The browser talks to your app over HTTPS.

<details class="optional-reading" markdown="1">
<summary>Commands your agent runs</summary>

    blossom database_instance:create --data postgres.yml --follow
    blossom environment_link:create --data database-link.yml
    blossom service:create --data core.yml
    blossom service:create --data web.yml
    blossom env_var:push --environment environment-100 --file supertokens.env
    blossom environment:deploy --id environment-100 --follow
    blossom service:scale --id service-web-100 --desired-size 1 --follow

</details>

<details class="optional-reading" markdown="1">
<summary>Notes for your agent</summary>

Link the managed database as `SUPERTOKENS_DATABASE_URL`. In Core's
startup command, export that value as `POSTGRESQL_CONNECTION_URI`
and run the image's normal entrypoint. Use `API_KEYS` in Core and
the matching key in the backend's private settings.
The [self-hosting guide](https://supertokens.com/docs/deployment/self-host-supertokens)
covers Core configuration.

Use the [Core license](https://github.com/supertokens/supertokens-core/blob/master/LICENSE.md)
to check the terms for the features you choose. This flow uses the free
Core and SDK features.

</details>

## Add Sign-in to Your App

Initialize the [backend SDK](https://supertokens.com/docs/authentication/email-password/initial-setup)
with email and password sign-in and sessions. Serve the frontend and API
on one HTTPS origin and use HTTP-only session cookies. Require a session
before serving the notes endpoint.

![Sign in to the sample Workshop Notes app.](/deploy/assets/images/supertokens/workshop-sign-in.webp)

## Sign In and Open a Note

Create a test account, sign out, then sign back in. Open the sample note.
Confirm a browser without a session needs to sign in first.

> **Ask your AI agent:** Help me create a test account, sign in, and open the signed-in notes page.

> Follow this guide: https://blossom88.com/deploy/supertokens/



## Keep It Running

Replace the Core Container and keep PostgreSQL online. Ask the sample app
to renew the existing session and verify it opens the same note for the
same account.

![Reopen the same note after replacing the private Core.](/deploy/assets/images/supertokens/workshop-notes-after-restart.webp)

## What You Get

- Email and password sign-in for a sample app
- A notes page that requires a signed-in session
- The same account after a Core Container replacement

Tested on Blossom: The original browser session renewed for the same user after replacing the private SuperTokens Core Container.
