Skip to content

Follow the SDKs' BFF contract, use the latest SDK, and add E2E suites - #39

Open
brionmario wants to merge 1 commit into
thunder-id:mainfrom
brionmario:bff-contract-sdk
Open

brionmario wants to merge 1 commit into
thunder-id:mainfrom
brionmario:bff-contract-sdk

Conversation

@brionmario

@brionmario brionmario commented Nov 27, 2026 •

Copy link
Copy Markdown
Member

Purpose

The Node.js SDKs now follow the BFF contract of RFC 10017 (thunder-id/thunderid#7095):

  • Next.js and Nuxt: the session cookie is encrypted with THUNDERID_SESSION_SECRET, which must be at least 32 bytes in production.
  • Express: @thunderid/express serves the whole contract with thunderIDBff().

This updates the samples to match, moves every sample to the latest SDK release, and adds a dedicated end-to-end suite for every sample.

Approach

Latest SDK in every sample

  • Every sample's @thunderid/* dependencies are latest instead of a pinned version, so the samples always show the current SDK.
  • Each lockfile resolves the current releases, for example @thunderid/react 1.29.0, @thunderid/nextjs 1.25.0, @thunderid/express 1.22.0 and @thunderid/nuxt 1.25.0.
  • Samples keep no compatibility with older SDK releases.
  • AGENTS.md gains an SDK versions section that states this for each package manager and gives the steps for moving the samples after a release.

BFF contract

  • quickstart-nextjs, quickstart-nextjs-b2b, wayfinder-enterprise-nextjs:
    • They set THUNDERID_SESSION_SECRET only.
    • The quickstart's config check requires it.
    • "Signs the session cookie" is corrected to "Encrypts".
  • quickstart-nuxt: states the 32-byte minimum.
  • bff-react-express:
    • Replaces its hand-written endpoints and lib/proxy.mjs with thunderIDBff({apiBaseUrl, exposeAccessToken: true}).
    • /token stays on because the Token debug page uses it. A comment marks it as the optional token-mediating pattern.
    • The README documents the request rules, /switch and back-channel logout, and says HTTPS is needed in production, since the cookie is Secure with the __Host- prefix there.

E2E suites (tests/e2e)

  • Each sample has a suite at tests/e2e/<area>/<sample>-e2e:
    • Web and server samples (14): Playwright. Each suite starts its sample through Playwright's webServer, with the sample's own lockfile and so its published SDK, and passes the app's config as environment variables.
    • Mobile samples (4): Maestro, with a run-e2e.sh per app.
  • Shared (tests/e2e/shared): server start and admin token, the import of every sample's OAuth client, test users, and the common page objects.
  • Ported or new:
    • The quickstart suites are ported from the SDK repositories, without their wiring of local SDK builds.
    • admin-react, myaccount-react, bff-react-express, better-auth-nextjs, the B2B samples and app-auth-flutter have new suites.
  • CI (.github/workflows/e2e.yml): runs a web suite on a pull request when its sample, its suite or the shared setup changes, against a fresh server of the latest ThunderID release.
    • A suite whose sample needs more than that release offers carries a ci-skip file with the reason. The three B2B suites have one for now, because the latest release rejects their samples' configuration.
    • Mobile suites aren't in CI yet.

Test results

Suite Result
browser, react, vue, nextjs, nuxt, express, node, admin-react, myaccount-react, bff-react-express, better-auth-nextjs Pass in CI against the latest ThunderID release. All but nuxt also pass locally against ThunderID 1.1.1.
quickstart-ios, quickstart-flutter, app-auth-flutter Pass locally on an iOS Simulator (3/3, 3/3, 2/2 flows)
quickstart-android Not run (no Android emulator). Script and flows checked for syntax only.
quickstart-react-b2b, quickstart-nextjs-b2b, wayfinder-enterprise-nextjs Not run: they need a ThunderID server built from main. Skipped in CI through ci-skip.

Format check, lint and build pass in every sample.

Related Issues

Related PRs

Checklist

  • Followed the contribution guidelines.
  • Manual test round performed and verified. (Through the E2E suites above.)
  • Documentation provided. (The sample READMEs, tests/e2e/README.md and AGENTS.md.)
  • Tests provided. (E2E suites under tests/e2e.)

@brionmario
brionmario marked this pull request as ready for review November 27, 2026 20:09
@brionmario brionmario changed the title Follow the SDKs' BFF contract in the Next.js, Nuxt and BFF samples Follow the SDKs' BFF contract and use the latest SDK in every sample Nov 28, 2026
@brionmario
brionmario force-pushed the bff-contract-sdk branch 2 times, most recently from 8f20a2d to 9a5f157 Compare November 28, 2026 05:47
@brionmario brionmario changed the title Follow the SDKs' BFF contract and use the latest SDK in every sample Follow the SDKs' BFF contract, use the latest SDK, and add E2E suites Nov 28, 2026
The Node.js SDKs now follow the BFF contract of RFC 10017
(thunder-id/thunderid#7095): the Next.js and Nuxt session cookie is
encrypted with THUNDERID_SESSION_SECRET, which must be at least 32 bytes in
production, and @thunderid/express serves the whole contract with
thunderIDBff().

- Every sample depends on its @ThunderID packages as "latest", so it always
  shows the current SDK. The lockfiles resolve the current releases.
- AGENTS.md states the rule for every package manager: samples use the
  latest SDK release, and carry no compatibility with older ones.
- The Next.js quickstarts and the Wayfinder sample set
  THUNDERID_SESSION_SECRET only, and the quickstart's config check requires
  it.
- The Nuxt quickstart states the 32-byte minimum.
- bff-react-express replaces its hand-written endpoints and proxy with
  thunderIDBff(), and documents the request rules and the opt-in token
  endpoint.
- tests/e2e holds a dedicated end-to-end suite for every sample, at
  tests/e2e/<area>/<sample>-e2e: Playwright for the web and server samples,
  Maestro for the mobile ones. They share one server setup, client import
  and set of page objects in tests/e2e/shared, and run the sample with its
  published SDK. The quickstart suites are ported from the SDK repositories;
  the others are new.
- The E2E workflow runs a web suite on a pull request when its sample, its
  suite or the shared setup changes, against the latest ThunderID release.
  Suites whose sample needs more than that release offers carry a ci-skip
  file; the B2B suites do for now. Mobile suites are not in CI yet; the
  iOS, Flutter and app-auth-flutter ones pass locally on a simulator.

Signed-off-by: Brion <info@brionmario.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant