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
40 changes: 40 additions & 0 deletions examples/supertokens-migration-nextjs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Next.js SuperTokens Migration Example

This example verifies Rownd-to-SuperTokens lazy migration through `@rownd/next`.

It has two apps:

- `backend`: Express + SuperTokens + `@supertokens-plugins/rownd-nodejs`
- `frontend`: Next.js App Router + `@rownd/next`

## Run

Build the local SDK packages from the repo root first:

```bash
npm run build
```

Start SuperTokens Core locally, then run the backend:

```bash
cd backend
cp .env.example .env
npm install
npm run dev
```

Set `ROWND_APP_KEY` and `ROWND_APP_SECRET` in `backend/.env` before starting the backend.

Run the Next.js frontend:

```bash
cd frontend
cp .env.example .env.local
npm install
npm run dev
```

Set `NEXT_PUBLIC_ROWND_APP_KEY` in `frontend/.env.local` to the same Rownd app key used by the backend.

Open `http://localhost:3000`, sign up as a new Rownd user, and verify that the backend receives `POST /auth/plugin/rownd/migrate`.
13 changes: 13 additions & 0 deletions examples/supertokens-migration-nextjs/backend/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
SUPERTOKENS_CONNECTION_URI=http://localhost:3567
# SUPERTOKENS_API_KEY=your_core_api_key # only needed if you set one in supertokens-core

ROWND_APP_KEY=your_rownd_app_key
ROWND_APP_SECRET=your_rownd_app_secret

PORT=3001
WEBSITE_ORIGIN=http://localhost:3000

# Origin of the Rownd Hub iframe. Migration fetches come from the Hub, not from
# the host app. Use http://localhost:8787 when running Hub locally, or
# https://hub.rownd.io for production.
HUB_ORIGIN=http://localhost:8787
2 changes: 2 additions & 0 deletions examples/supertokens-migration-nextjs/backend/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
.env
Loading
Loading