# snafx/opusm-assessment architecture

> Architecture diagram of the GitHub repository snafx/opusm-assessment, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-18). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/snafx/opusm-assessment
- Repository: https://github.com/snafx/opusm-assessment

## Overview

This repository is an assessment starter for a skill-management app on SAP Field Service Management (FSM). The intended user workflow is to manage a skill matrix, assign skills with validity periods, and attach certificates; the checked-in UI is still a setup page that checks connectivity and lists people. The implemented foundation is a browser client, a server-side FSM proxy with OAuth and write restrictions, and shared-company name scoping. The documented management features are goals, not sampled implementations, so the graph shows available API capabilities without implying those screens or workflows exist. Links reflect excerpts, the source index, or README statements.

Main entry points: [`src/app/api/health/route.ts`](https://github.com/snafx/opusm-assessment/blob/main/src/app/api/health/route.ts) (Connection check), [`src/components/StarterPage.tsx`](https://github.com/snafx/opusm-assessment/blob/main/src/components/StarterPage.tsx) (Setup page), [`src/app/api/fsm/[...path]/route.ts`](https://github.com/snafx/opusm-assessment/blob/main/src/app/api/fsm/%5B...path%5D/route.ts) (FSM API proxy), [`src/lib/fsm/token.ts`](https://github.com/snafx/opusm-assessment/blob/main/src/lib/fsm/token.ts) (OAuth session)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["App entry and UI"]
  node_home["Home entry<br/>[page.tsx]"]
  node_starter["Setup page<br/>[StarterPage.tsx]"]
  node_providers["UI providers<br/>[AppProviders.tsx]"]
  node_ui5setup["UI5 assets<br/>[ui5-setup.ts]"]
end

subgraph group_client["Browser integration"]
  node_candidate["Name scoping<br/>[candidate.ts]"]
  node_fsmclient["FSM browser client<br/>[client.ts]"]
  node_dtos["DTO versions<br/>[dtos.ts]"]
end

subgraph group_server["Server and FSM access"]
  node_proxy["FSM API proxy<br/>[route.ts]"]
  node_health["Connection check<br/>[route.ts]"]
  node_session["OAuth session<br/>[token.ts]"]
  node_config["FSM configuration<br/>[config.ts]"]
  node_headers["FSM headers<br/>[headers.ts]"]
end

node_browser(("Browser user"))
node_fsm{{"SAP FSM APIs"}}
node_oauth{{"OAuth service"}}

node_browser -.->|"opens"| node_home
node_home -->|"renders"| node_starter
node_starter -->|"queries people"| node_fsmclient
node_starter -->|"checks connection"| node_health
node_starter -->|"reads namespace"| node_candidate
node_providers -->|"loads assets"| node_ui5setup
node_fsmclient -->|"fetches API"| node_proxy
node_fsmclient -->|"uses versions"| node_dtos
node_proxy -->|"gets session"| node_session
node_proxy -->|"sets headers"| node_headers
node_proxy -->|"proxies requests"| node_fsm
node_session -->|"loads settings"| node_config
node_session -->|"requests token"| node_oauth
node_health -->|"gets session"| node_session
node_health -->|"sets headers"| node_headers
node_health -->|"uses person DTO"| node_dtos
node_health -->|"counts people"| node_fsm
node_home -.->|"uses layout"| node_providers

click node_home "https://github.com/snafx/opusm-assessment/blob/main/src/app/page.tsx"
click node_starter "https://github.com/snafx/opusm-assessment/blob/main/src/components/StarterPage.tsx"
click node_providers "https://github.com/snafx/opusm-assessment/blob/main/src/components/providers/AppProviders.tsx"
click node_ui5setup "https://github.com/snafx/opusm-assessment/blob/main/src/components/providers/ui5-setup.ts"
click node_candidate "https://github.com/snafx/opusm-assessment/blob/main/src/lib/candidate.ts"
click node_fsmclient "https://github.com/snafx/opusm-assessment/blob/main/src/lib/fsm/client.ts"
click node_dtos "https://github.com/snafx/opusm-assessment/blob/main/src/lib/fsm/dtos.ts"
click node_proxy "https://github.com/snafx/opusm-assessment/blob/main/src/app/api/fsm/%5B...path%5D/route.ts"
click node_health "https://github.com/snafx/opusm-assessment/blob/main/src/app/api/health/route.ts"
click node_session "https://github.com/snafx/opusm-assessment/blob/main/src/lib/fsm/token.ts"
click node_config "https://github.com/snafx/opusm-assessment/blob/main/src/lib/fsm/config.ts"
click node_headers "https://github.com/snafx/opusm-assessment/blob/main/src/lib/fsm/headers.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_home,node_starter,node_providers,node_ui5setup,node_browser toneBlue
class node_candidate,node_fsmclient,node_dtos toneAmber
class node_proxy,node_health,node_session,node_config,node_headers,node_fsm toneMint
class node_oauth toneIndigo
```

## Components

### App entry and UI

- [Home entry](https://github.com/snafx/opusm-assessment/blob/main/src/app/page.tsx): `src/app/page.tsx`
- [Setup page](https://github.com/snafx/opusm-assessment/blob/main/src/components/StarterPage.tsx): `src/components/StarterPage.tsx`
- [UI providers](https://github.com/snafx/opusm-assessment/blob/main/src/components/providers/AppProviders.tsx): `src/components/providers/AppProviders.tsx`
- [UI5 assets](https://github.com/snafx/opusm-assessment/blob/main/src/components/providers/ui5-setup.ts): `src/components/providers/ui5-setup.ts`

### Browser integration

- [Name scoping](https://github.com/snafx/opusm-assessment/blob/main/src/lib/candidate.ts): `src/lib/candidate.ts`
- [FSM browser client](https://github.com/snafx/opusm-assessment/blob/main/src/lib/fsm/client.ts): `src/lib/fsm/client.ts`
- [DTO versions](https://github.com/snafx/opusm-assessment/blob/main/src/lib/fsm/dtos.ts): `src/lib/fsm/dtos.ts`

### Server and FSM access

- [FSM API proxy](https://github.com/snafx/opusm-assessment/blob/main/src/app/api/fsm/%5B...path%5D/route.ts): `src/app/api/fsm/[...path]/route.ts`
- [Connection check](https://github.com/snafx/opusm-assessment/blob/main/src/app/api/health/route.ts): `src/app/api/health/route.ts`
- [OAuth session](https://github.com/snafx/opusm-assessment/blob/main/src/lib/fsm/token.ts): `src/lib/fsm/token.ts`
- [FSM configuration](https://github.com/snafx/opusm-assessment/blob/main/src/lib/fsm/config.ts): `src/lib/fsm/config.ts`
- [FSM headers](https://github.com/snafx/opusm-assessment/blob/main/src/lib/fsm/headers.ts): `src/lib/fsm/headers.ts`

### Other components

- **Browser user**
- **SAP FSM APIs**
- **OAuth service**

## Connections

- Browser user → Home entry: opens (evidence: `README.md`)
- Home entry → Setup page: renders (evidence: `src/app/page.tsx`)
- Setup page → FSM browser client: queries people (evidence: `src/components/StarterPage.tsx`)
- Setup page → Connection check: checks connection (evidence: `src/components/StarterPage.tsx`)
- Setup page → Name scoping: reads namespace (evidence: `src/components/StarterPage.tsx`)
- UI providers → UI5 assets: loads assets (evidence: `src/components/providers/AppProviders.tsx`)
- FSM browser client → FSM API proxy: fetches API (evidence: `README.md`)
- FSM browser client → DTO versions: uses versions (evidence: `src/lib/fsm/client.ts`)
- FSM API proxy → OAuth session: gets session (evidence: `src/app/api/fsm/[...path]/route.ts`)
- FSM API proxy → FSM headers: sets headers (evidence: `src/app/api/fsm/[...path]/route.ts`)
- FSM API proxy → SAP FSM APIs: proxies requests (evidence: `src/app/api/fsm/[...path]/route.ts`)
- OAuth session → FSM configuration: loads settings (evidence: `src/lib/fsm/token.ts`)
- OAuth session → OAuth service: requests token (evidence: `src/lib/fsm/token.ts`)
- Connection check → OAuth session: gets session (evidence: `src/app/api/health/route.ts`)
- Connection check → FSM headers: sets headers (evidence: `src/app/api/health/route.ts`)
- Connection check → DTO versions: uses person DTO (evidence: `src/app/api/health/route.ts`)
- Connection check → SAP FSM APIs: counts people (evidence: `src/app/api/health/route.ts`)
- Home entry → UI providers: uses layout
