Zum Hauptinhalt springen

Quickstart — neues Lane-A-Produkt

Ziel: In unter einer Stunde läuft lokal eine App, die ihre Product-Id kennt, mit den richtigen Headern zur DIC Control Plane spricht und bereit ist, eine Collection zu binden.

Dieser Weg ist für eine neue Capability (Lane A). Hast du schon ein Backend, nimm Bestehendes Backend anbinden.

Was du brauchst​

  • Node 20+ und npm
  • Zugriff auf @chbrdk/plexon-federation und @chbrdk/dic-app (GitHub Packages oder Vendor/Source-Pin)
  • Eine Test-Control-Plane-URL und ein Nicht-Produktions-Service-Secret (niemals committen)
export PLEXON_BASE="https://plexon-v3.projects-a.plygrnd.tech"
export PLEXON_SERVICE_SECRET="…"
export PLEXON_USER_ID="…"

1. Produkt-Shell scaffolden​

npm run scaffold:lane-a -- --name demo-portal

--skip-plexon nur für Wegwerf-Demos. Für ein echtes Produkt weglassen.

2. Pakete installieren​

npm install @chbrdk/plexon-federation@0.2.1 @chbrdk/dic-app@0.1.0

3. App einmal definieren​

import { defineDicApp } from '@chbrdk/dic-app'

export const app = defineDicApp({
productId: 'demo',
productName: 'Demo Portal',
nav: [
{ id: 'home', label: 'Home', href: '/' },
{ id: 'settings', label: 'Settings', href: '/settings' },
],
settingsHref: '/settings',
})

4. Federation auf dem Server​

import { buildFederationHeaders, FEDERATION_CONTRACT_VERSION } from '@chbrdk/plexon-federation'

export function controlPlaneHeaders(viewerUserId: string) {
return buildFederationHeaders({
contractVersion: FEDERATION_CONTRACT_VERSION,
serviceSecret: process.env.PLEXON_SERVICE_SECRET!,
userId: viewerUserId,
})
}

Secrets gehören nicht in den Browser.

5. Collections prüfen​

curl -sS "${PLEXON_BASE}/api/platform/provisioning/accessible-collections" \
-H "X-Service-Secret: ${PLEXON_SERVICE_SECRET}" \
-H "X-Plexon-Contract-Version: 2026-05-plexon-federation-v3" \
-H "X-Plexon-User-Id: ${PLEXON_USER_ID}"

200 ist gut — auch mit leerer Liste. Ohne X-Plexon-User-Id sollte es scheitern (Access Model B).

6. Shell auf den Screen​

import { DicAppLayout, DicAppProviders } from '@chbrdk/dic-app'
import { app } from './app'

export default function RootLayout({ children }: { children: React.ReactNode }) {
return (
<DicAppProviders>
<DicAppLayout app={app}>{children}</DicAppLayout>
</DicAppProviders>
)
}

Fertig, wenn…​

  • App startet mit DIC-Shell
  • accessible-collections liefert 200
  • Derselbe Call ohne Viewer-Id scheitert

Was oft schiefgeht​

SymptomUrsacheFix
npm 401Kein Packages-Token.npmrc / Registry-Zugang
Control Plane 401Header unvollständigSecret + Contract + User-Id
Control Plane 403Kein GrantAnderen User / Invite
Shell „leer“Provider fehltSchritt 6

Weiter: Collections und Zugriff · Auth