Skip to content

Add the React and Next.js B2B quickstarts - #27

Merged
AnuradhaSK merged 1 commit into
thunder-id:mainfrom
AnuradhaSK:add-b2b-quickstarts
Nov 13, 2026
Merged

AnuradhaSK merged 1 commit into
thunder-id:mainfrom
AnuradhaSK:add-b2b-quickstarts

Conversation

@AnuradhaSK

@AnuradhaSK AnuradhaSK commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Purpose

Adds two B2B quickstarts, quickstarts/react-b2b (@thunderid/react) and quickstarts/nextjs-b2b (@thunderid/nextjs). They are the apps behind the new React and Next.js B2B quickstart pages in the ThunderID docs. Each company that signs up becomes its own organization unit (OU) in ThunderID.

Both apps show the same five things:

  • Company sign-up. Register your company on the sign-in page creates the company OU and its first admin, then signs the admin in.
  • Where the account lives. Sign-up asks the user to choose:
    • My account belongs to this company creates the account inside the company.
    • I work with several companies creates it in the platform organization and shares it into the company, so the same account can join more companies later.
  • Organization and roles in the token. The app shows the access token's ouId, ouHandle, ouName, roles and scope.
  • Switching companies with OrganizationUnitSwitcher.
  • Enterprise SSO per company. A company admin adds an OpenID Connect connection and selects it with FlowVariablesForm. Employees then choose Sign in with enterprise SSO and enter the company's handle.

Each quickstart ships a thunderid-config/ bundle that creates every resource it needs, with fixed IDs: the platform OU, user type, Admin and Member roles, sign-up and sign-in flows, and the application.

This PR also registers both quickstarts in the repository:

  • Rows in the root README's quickstart table.
  • Banners and banners.json entries.
  • sample_quickstarts_react_b2b and sample_quickstarts_nextjs_b2b inputs in the release workflow.

The PR builder finds both through their package.json, so they are built and linted without a workflow change.

Screenshots

Taken against a local ThunderID server built from main. In each app, a company was registered with My account belongs to this company.

React B2B Quickstart (https://localhost:5173)

Landing page Sign-in page Signed in as the company's admin
react-1-landing react-2-sign-in react-3-signed-in

Next.js B2B Quickstart (http://localhost:3000)

Landing page Sign-in page Signed in as the company's admin
nextjs-1-landing nextjs-2-sign-in nextjs-3-signed-in

Approach

Platform organization. Each quickstart's platform organization is a root OU in the Default project. Companies are created beneath it at sign-up. Only the Control Plane creates a root OU and writes server config, so the bundles are imported there.

Two import files. The Console tests an import before running it, and that test only finds OUs that already exist. So organization-unit.yaml is imported on its own, before thunderid-config.yaml.

One sign-up flow for both kinds of account. An application binds a single registration flow, and its sign-in flow can call only that one (APP-1039). Both kinds of sign-up therefore live in one flow, behind the Register your company choice screen.

Roles and permissions. The shared Admin role grants org, which manages the organization the token names. Member grants nothing. The admin's token carries org, and the app shows the Enterprise SSO section only when the token's scope includes it.

Each README has a production note. org manages everything in a company, so production apps should grant it only to trusted admins, or route management calls through their own server, as the Wayfinder Enterprise sample does.

How each app gets its token.

React Next.js
Client Public client with PKCE Confidential client; tokens stay on the server
How the token gets org Names the System resource server in resource on sign-in and on switch The bundle sets the defaultResourceServer server config to the System resource server, because @thunderid/nextjs 1.18.1 drops sign-in options in redirect mode
Runs on https (@vitejs/plugin-basic-ssl), so a switch can reuse the ThunderID session in a hidden frame http

Server version. Both apps need a ThunderID server built from main. They use features newer than 2.0.0-m1, such as the org permission.

Related Issues

Related PRs

Checklist

  • Followed the contribution guidelines.
  • Manual test round performed and verified.
  • Documentation provided. (quickstarts/react-b2b/README.md, quickstarts/nextjs-b2b/README.md)
  • Tests provided. (Add links if there are any)
    • Unit Tests
    • Integration Tests
  • Breaking changes. (Fill if applicable)
    • Breaking changes section filled.
    • breaking change label added.

Security checks

  • Followed secure coding standards.
  • Confirmed that this PR doesn't commit any keys, passwords, tokens, usernames, or other secrets.

The Next.js quickstart ships a placeholder client secret for local setup (NEXTJS_B2B_CLIENT_SECRET in thunderid-config/thunderid.env and THUNDERID_CLIENT_SECRET in .env.example). It is not a real credential, and the README says to change it before importing.

🤖 Generated with Claude Code

Each app lets a company sign up as its own organization, with the first
account inside the company or shared into it, shows the organization and
roles the tokens carry, switches between the companies an account belongs
to, and lets a company admin plug in the company's identity provider.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: AnuradhaSK <anuradha199528@gmail.com>
@AnuradhaSK
AnuradhaSK merged commit 8c26bea into thunder-id:main Nov 13, 2026
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants