Skip to content

jadu-sso-fe

The JaduSSO login surface — the centralized sign-in app that tenant applications (story-desk, studio, minimatics) redirect unauthenticated users to. It owns login, email-OTP verify, forgot-password, and the no-access (RBAC denial) screens. On success it bounces the user back to the consumer app via ?returnTo=, gating on ?appId= RBAC first.

It lives inside the jadu-auth monorepo (next to the auth backend it talks to) so SSO is insulated from churn in other repos — only changes merged here can affect it. It was lifted out of jadu-account (PR #5) into this directory.

Why a fetch shim instead of the @scenarix/jadu-auth SDK

lib/jaduAuth/ is a small fetch client that re-implements the SDK's React surface (JaduAuthProvider, useJaduAuth, AuthState) but talks to the jadu-auth backend directly. The login page creates sessions — it needs loginWithEmailPassword, loginInitWithEmailOtp / Verify, forgotPasswordInit / Verify. The SDK (2.0.0+) is session-consume-only and removed all of those, so it cannot drive a login page. The shim is the correct artifact here, not a temporary workaround. A tsconfig.json path alias plus a next.config.ts bundler alias redirect every from '@scenarix/jadu-auth/react' import to the shim.

@scenarix/jadu-ui (the private shadcn component library) is consumed normally from GitHub Packages — see .npmrc.

Standalone, not a workspace member

This app is not part of the root package.json workspaces array. It keeps its own package.json, .npmrc, lockfile, node_modules, Tailwind v4, and Biome config. (The monorepo root pins tailwindcss@3.4.19 via overrides, which would clobber jadu-ui's required Tailwind v4 if this joined the workspace.) Run every command from inside sso-fe/.

Stack

  • Next.js 16 (App Router, output: "export" static export, React Compiler)
  • React 19, TypeScript strict
  • Tailwind CSS v4 (CSS-only; no tailwind.config.js)
  • @scenarix/jadu-ui for UI components
  • Biome for lint + format

Setup

cp .env.example .env          # then fill values
export GITHUB_PKG_TOKEN=...    # needed to install @scenarix/jadu-ui
npm install
npm run dev                    # dev server (default port 3000)

NEXT_PUBLIC_* values are inlined at build time (static export). Set them in CI / your static host before npm run build, not at runtime.

Variable Purpose
NEXT_PUBLIC_AUTH_API_URL jadu-auth backend base URL (the shim probes /api/auth/sso/me here)
NEXT_PUBLIC_AUTH_APP_ID App identifier for the cookie identity probe (jadu_central_profile)
NEXT_PUBLIC_APPLY_URL Jadu Apply portal — the "Request early access" link
NEXT_PUBLIC_JADU_ACCOUNT_URL jadu-account origin — where a signed-in user with no app context lands (the /profile page)

Commands

npm run dev      # dev server
npm run build    # static export → out/
npm run lint     # biome check
npm run format   # biome format --write

CSS — do not touch the three top lines of app/globals.css

@import "tailwindcss";
@import "@scenarix/jadu-ui/styles/globals.css";
@source "../node_modules/@scenarix/jadu-ui/dist/**/*.js";

<html> must keep className="dark" — theme tokens live under .dark. Use theme tokens (bg-background, text-foreground, …), never hardcoded hex.