Claude 1f2141118d feat: Phase 2 — layout · auth · shell are real
@gsc/web-kit v0.2.0. Three modules turn from stubs into the working
surface apps need to render a chrome-wrapped Next.js page with one
import per concern.

auth/server:
- createAuth({ keycloak: { clientId, clientSecret, issuer } }) factory
  returns { handlers, signIn, signOut, auth, requireAuth, signInPath }.
  Canonical SessionUser shape (id, keycloakId, tenantId, email,
  displayName, givenName, familyName, roles, accessToken, idToken)
  baked into the session callback. Apps drop their hand-rolled
  src/auth.ts (~80 lines) for a 6-line factory call.
- requireAuth() — server-only. await it at the top of an RSC layout
  or page; redirects to signInPath if no session.

auth/middleware:
- createAuthMiddleware({ publicRoutes? }) returns a Next.js middleware
  that redirects unauth'd requests to /api/auth/signin/keycloak with
  ?callbackUrl=<original>. Bypasses /api/auth/*, /_next/*, /images/*,
  favicon, robots.txt always.

auth (client):
- signInRedirect(callbackUrl?) — hard-nav from any client component.

shell/server:
- fetchShellConfig({ appKey, accessToken, apiUrl?, timeoutMs? }).
  Server-only fetcher. 3s default timeout. Graceful fallback config
  on any error — shell-api outages can't blank-screen a host app.

shell (client):
- <ShellProvider> + useShell() — read the resolved config from any
  descendant of <AppLayout>.

layout:
- <AppLayout config currentPath translate onSignOut navbarExtras>.
  Renders the chronos-style Bootstrap-Layout-3 chrome (navbar-static,
  sidebar-light sidebar-main with collapse + persistence in
  localStorage, navbar-footer). Wraps children with the kit's
  ShellProvider so useShell() works.

devDep: @types/node for the server-side process.env read.

All 14 sub-exports still resolve under dist/. Phase 3 (data + forms)
and the gscCRM pilot cutover come next.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-11 00:20:08 +02:00

@gsc/web-kit

App skeleton for GSC Next.js frontends. Wraps @limitless/ui primitives into a pre-configured layout + auth + data/forms/feedback stack so apps just write their domain pages.

See the implementation plan in the parent repo for the full module map. This is a file: dep consumed by every GSC frontend.

Install (in a consumer app)

// package.json
{
  "dependencies": {
    "@gsc/web-kit": "file:../../../templates/gsc-web-kit"
  }
}

Layered architecture

your app
  └── @gsc/web-kit         ← this package (layout, auth, data, forms…)
        └── @limitless/ui   ← Bootstrap-flavoured primitives
              └── bootstrap

Sub-exports

import "@gsc/web-kit/css";              // CSS bundle (layout-3 + JetBrains Mono)
import { AppLayout } from "@gsc/web-kit/layout";
import { createAuth } from "@gsc/web-kit/auth/server";
import { fetchShellConfig } from "@gsc/web-kit/shell/server";
import { EntityList } from "@gsc/web-kit/data";
import { Form, TextField } from "@gsc/web-kit/forms";
import { useToast } from "@gsc/web-kit/feedback";
import { Breadcrumbs } from "@gsc/web-kit/navigation";
import { createApiClient } from "@gsc/web-kit/api";
import { formatCurrency } from "@gsc/web-kit/utils";

Phases

Phase Scope Status
1 Package scaffold + CSS bundle + sub-export stubs in progress
2 layout · auth · shell — usable end-to-end with shell-api planned
3 data · forms — EntityList, Form, DefineAction planned
4 feedback · navigation · api · utils planned
5 Roll out to gscCRM / gscChronos / gscAdmin / gscPortal planned
Description
App skeleton for GSC Next.js frontends. Layout, auth, data, forms, feedback, navigation on top of @limitless/ui.
Readme 454 KiB
Languages
TypeScript 92%
CSS 5.4%
JavaScript 2.6%