This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
yarn install # Install dependencies
yarn dev # Start development server (port 3000)
yarn build # Production build
yarn test # Run tests in watch mode
yarn test:ci # Run tests once (CI mode)Run a single test file:
yarn test -- --testPathPattern="<filename>"Lint is enforced via ESLint during webpack builds (dev and CI). To run manually:
npx eslint src --ext .ts,.tsxThis is a React 17 + TypeScript app that serves as a living collection of code samples demonstrating Mosaic microservice integrations. The user browses and runs individual "scenarios" from a host shell UI.
The core pattern:
- src/scenario-registry.ts — Central array registering all scenarios. Each entry has
groupName,shortId,displayName,displayOrder, androotComponent. - src/index.tsx — Passes the scenario array into
<ScenarioHostApp />from@axinom/mosaic-fe-samples-host. - ScenarioHost (external package) — Renders the selected scenario and provides context via the
useScenarioHost()hook, which exposesactiveProfile(service endpoints/config),logger,setVariable, andgetVariable.
Adding a new scenario means: create a component under src/scenarios/<group>/, register it in scenario-registry.ts.
Each scenario follows a container/content split:
src/scenarios/<group>/<ScenarioName>/
<ScenarioName>.tsx # Container: wraps with providers (Apollo, UserServiceProvider, etc.)
<ScenarioName>Content.tsx # Presentational: uses hooks, renders UI
The container sets up ApolloProvider (built via createApolloClient from src/apollo-client.ts) and UserServiceProvider, passing activeProfile endpoint URLs as config.
Scenarios share data (e.g., access tokens) through setVariable/getVariable using string keys defined in src/common/types/well-known-variable-keys.ts.
src/apollo-client.ts creates an Apollo Client supporting both HTTP and WebSocket (subscriptions) via a split link. Cache is configured with addTypename: false.
- Semantic UI React — pre-built UI components (buttons, forms, labels, etc.)
- Tailwind CSS — utility classes for layout/spacing
- Functional components only — no class components.
- Environment config lives in
.env(copy from.env.template). Loaded viaenv-cmd. - TypeScript is type-checked by
ForkTsCheckerWebpackPlugin; Babel handles transpilation (sotscalone won't emit output). - Test files:
*.test.ts(x)or*.spec.ts(x)undersrc/.