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, and moves every sample to the latest SDK release.

Approach

  • Every sample: its @thunderid/* dependencies are latest instead of a pinned version, so the samples always show the current SDK. Each lockfile now resolves the current releases (for example @thunderid/react 1.29.0, @thunderid/nextjs 1.25.0, @thunderid/express 1.22.0, @thunderid/nuxt 1.25.0). Format check, lint and build pass in all 14 samples.

  • quickstart-nextjs, quickstart-nextjs-b2b, wayfinder-enterprise-nextjs:

    • They set THUNDERID_SESSION_SECRET only. The samples don't carry settings for older SDK versions.
    • The quickstart's config check requires THUNDERID_SESSION_SECRET.
    • "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): a dedicated suite for every sample, at tests/e2e/<area>/<sample>-e2e.

    • Web and server samples (14): Playwright. Each suite starts its sample with Playwright's webServer, using 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: the latest release rejects their samples' configuration.
      • Mobile suites aren't in CI yet.
    • Local results: run against ThunderID 1.1.1, from the committed tree.
      • 10 web suites pass: browser, react, vue, nextjs, express, node, admin-react, myaccount-react, bff-react-express and better-auth-nextjs.
      • Not run: nuxt (port taken locally; it passes in CI) and the B2B suites (need a newer server).
      • Mobile, on an iOS Simulator: quickstart-ios (3/3 flows), quickstart-flutter (3/3) and app-auth-flutter (2/2) pass. quickstart-android isn't run (no Android emulator here); its script and flows are checked for syntax only.
  • Align the Node.js SDKs with the BFF contract (RFC 10017) thunderid#7095

Related PRs

Checklist

  • Followed the contribution guidelines.
  • Manual test round performed and verified. (The Express quickstart starts on 1.22.0 and sets the Lax sign-in cookie; the others are checked by build only.)
  • Documentation provided. (The sample READMEs.)
  • 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