# themoment-team/datagsm-client-v2 architecture

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

- Interactive diagram: https://gitdiagram.com/themoment-team/datagsm-client-v2
- Repository: https://github.com/themoment-team/datagsm-client-v2

## Overview

DataGSM Client is a monorepo of separately deployed web apps for users, administrators, OAuth, projects, and service status. Its clearest runtime workflow is client/admin OAuth login: a login handler redirects to authorization, the callback exchanges the code for tokens and stores them in cookies, and authenticated server API clients attach an access token. The README also names a documentation app, but its files are absent from the supplied tree, so it is not mapped. Some app wiring and status-page calls were not excerpted; uncertain links are omitted or dashed.

Main entry points: [`apps/client/src/_pages/home/ui/HomePage.tsx`](https://github.com/themoment-team/datagsm-client-v2/blob/main/apps/client/src/_pages/home/ui/HomePage.tsx) (User web app), [`apps/client/src/shared/api/server.ts`](https://github.com/themoment-team/datagsm-client-v2/blob/main/apps/client/src/shared/api/server.ts) (Authenticated API clients), [`apps/admin/src/_pages/home/ui/HomePage.tsx`](https://github.com/themoment-team/datagsm-client-v2/blob/main/apps/admin/src/_pages/home/ui/HomePage.tsx) (Admin web app), [`packages/core/src/shared/auth/authRoutes.ts`](https://github.com/themoment-team/datagsm-client-v2/blob/main/packages/core/src/shared/auth/authRoutes.ts) (Auth route handlers)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_apps["Web applications"]
  node_clientapp["User web app<br/>[HomePage.tsx]"]
  node_adminapp["Admin web app<br/>[HomePage.tsx]"]
  node_oauthapp["OAuth screen<br/>[HomePage.tsx]"]
  node_projectsapp["Projects page<br/>[HomePage.tsx]"]
end

subgraph group_auth["Authentication"]
  node_authhandlers["Auth route handlers<br/>[authRoutes.ts]"]
  node_appauthroutes["App auth routes<br/>[route.ts]"]
  node_adminauthroutes["Admin auth routes<br/>[route.ts]"]
  node_oauthprotocol["OAuth protocol<br/>[oauth.ts]"]
  node_tokencookies["Token cookies<br/>[cookies.ts]"]
  node_authproxy["Token proxy<br/>[authProxy.ts]"]
  node_logout["Logout feature<br/>[endIdpSession.ts]"]
end

subgraph group_shared["Shared runtime"]
  node_coreapi["API client"]
  node_coreinterceptors["API interceptors<br/>[interceptors.ts]"]
  node_serverapi["Authenticated API clients<br/>[server.ts]"]
  node_browserapi["Browser API clients<br/>[client.ts]"]
  node_appconfig["App configuration<br/>[appEnv.ts]"]
  node_appurls["App URLs<br/>[appUrls.ts]"]
  node_oauthconfig["OAuth configuration<br/>[oauthEnv.ts]"]
  node_shell["App shell<br/>[AppShell.tsx]"]
  node_sidebar["App sidebar<br/>[AppSidebar.tsx]"]
end

subgraph group_status["Service status"]
  node_statusapp["Status page<br/>[HomePage.tsx]"]
  node_statusfetch["Status checks"]
  node_statuslist["Status list"]
  node_monitored["Monitored servers"]
end

node_visitor(("Browser user"))
node_backend{{"DataGSM API"}}
node_idp{{"Authorization server"}}

node_visitor -->|"uses"| node_clientapp
node_visitor -->|"uses"| node_adminapp
node_visitor -->|"uses"| node_oauthapp
node_visitor -->|"uses"| node_projectsapp
node_visitor -->|"views"| node_statusapp
node_clientapp -.->|"starts login"| node_appauthroutes
node_adminapp -.->|"starts login"| node_adminauthroutes
node_appauthroutes -.->|"delegates"| node_authhandlers
node_adminauthroutes -.->|"delegates"| node_authhandlers
node_authhandlers -->|"builds and exchanges"| node_oauthprotocol
node_authhandlers -->|"sets and clears"| node_tokencookies
node_oauthprotocol -->|"requests authorization and tokens"| node_idp
node_oauthapp -->|"provides login screen"| node_idp
node_clientapp -.->|"uses"| node_serverapi
node_adminapp -.->|"uses"| node_serverapi
node_serverapi -->|"creates client"| node_coreapi
node_serverapi -->|"attaches access token"| node_authproxy
node_browserapi -->|"creates client"| node_coreapi
node_browserapi -->|"registers unauthorized handler"| node_coreinterceptors
node_clientapp -.->|"uses"| node_browserapi
node_serverapi -.->|"sends API requests"| node_backend
node_clientapp -.->|"renders"| node_shell
node_adminapp -.->|"renders"| node_shell
node_shell -.->|"renders"| node_sidebar
node_appconfig -->|"validates base settings"| node_oauthconfig
node_appconfig -->|"exports URL settings"| node_appurls
node_statusapp -.->|"renders"| node_statuslist
node_statuslist -.->|"checks status"| node_statusfetch
node_statusfetch -.->|"checks configured servers"| node_monitored
node_logout -->|"ends IdP session"| node_idp

click node_clientapp "https://github.com/themoment-team/datagsm-client-v2/blob/main/apps/client/src/_pages/home/ui/HomePage.tsx"
click node_adminapp "https://github.com/themoment-team/datagsm-client-v2/blob/main/apps/admin/src/_pages/home/ui/HomePage.tsx"
click node_oauthapp "https://github.com/themoment-team/datagsm-client-v2/blob/main/apps/oauth/src/_pages/home/ui/HomePage.tsx"
click node_projectsapp "https://github.com/themoment-team/datagsm-client-v2/blob/main/apps/projects/src/_pages/home/ui/HomePage.tsx"
click node_statusapp "https://github.com/themoment-team/datagsm-client-v2/blob/main/apps/status/src/_pages/home/ui/HomePage.tsx"
click node_authhandlers "https://github.com/themoment-team/datagsm-client-v2/blob/main/packages/core/src/shared/auth/authRoutes.ts"
click node_appauthroutes "https://github.com/themoment-team/datagsm-client-v2/blob/main/apps/client/app/api/login/route.ts"
click node_adminauthroutes "https://github.com/themoment-team/datagsm-client-v2/blob/main/apps/admin/app/api/login/route.ts"
click node_oauthprotocol "https://github.com/themoment-team/datagsm-client-v2/blob/main/packages/core/src/shared/auth/oauth.ts"
click node_tokencookies "https://github.com/themoment-team/datagsm-client-v2/blob/main/packages/core/src/shared/auth/cookies.ts"
click node_authproxy "https://github.com/themoment-team/datagsm-client-v2/blob/main/packages/core/src/shared/auth/authProxy.ts"
click node_logout "https://github.com/themoment-team/datagsm-client-v2/blob/main/packages/core/src/features/logout/api/endIdpSession.ts"
click node_coreapi "https://github.com/themoment-team/datagsm-client-v2/blob/main/packages/core/src/shared/api/createApiInstance.ts"
click node_coreinterceptors "https://github.com/themoment-team/datagsm-client-v2/blob/main/packages/core/src/shared/api/interceptors.ts"
click node_serverapi "https://github.com/themoment-team/datagsm-client-v2/blob/main/apps/client/src/shared/api/server.ts"
click node_browserapi "https://github.com/themoment-team/datagsm-client-v2/blob/main/apps/client/src/shared/api/client.ts"
click node_appconfig "https://github.com/themoment-team/datagsm-client-v2/blob/main/packages/core/src/shared/config/appEnv.ts"
click node_appurls "https://github.com/themoment-team/datagsm-client-v2/blob/main/packages/core/src/shared/config/appUrls.ts"
click node_oauthconfig "https://github.com/themoment-team/datagsm-client-v2/blob/main/packages/core/src/shared/config/oauthEnv.ts"
click node_shell "https://github.com/themoment-team/datagsm-client-v2/blob/main/packages/core/src/widgets/app-shell/ui/AppShell.tsx"
click node_sidebar "https://github.com/themoment-team/datagsm-client-v2/blob/main/packages/core/src/widgets/app-shell/ui/AppSidebar.tsx"
click node_statusfetch "https://github.com/themoment-team/datagsm-client-v2/blob/main/apps/status/src/_pages/home/api/checkServerStatus.ts"
click node_statuslist "https://github.com/themoment-team/datagsm-client-v2/blob/main/apps/status/src/_pages/home/ui/ServerStatusList.tsx"
click node_monitored "https://github.com/themoment-team/datagsm-client-v2/blob/main/apps/status/src/_pages/home/config/monitoredServers.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_clientapp,node_adminapp,node_oauthapp,node_projectsapp,node_visitor toneBlue
class node_authhandlers,node_appauthroutes,node_adminauthroutes,node_oauthprotocol,node_tokencookies,node_authproxy,node_logout toneAmber
class node_coreapi,node_coreinterceptors,node_serverapi,node_browserapi,node_appconfig,node_appurls,node_oauthconfig,node_shell,node_sidebar,node_backend,node_idp toneMint
class node_statusapp,node_statusfetch,node_statuslist,node_monitored toneRose
```

## Components

### Web applications

- [User web app](https://github.com/themoment-team/datagsm-client-v2/blob/main/apps/client/src/_pages/home/ui/HomePage.tsx): `apps/client/src/_pages/home/ui/HomePage.tsx`
- [Admin web app](https://github.com/themoment-team/datagsm-client-v2/blob/main/apps/admin/src/_pages/home/ui/HomePage.tsx): `apps/admin/src/_pages/home/ui/HomePage.tsx`
- [OAuth screen](https://github.com/themoment-team/datagsm-client-v2/blob/main/apps/oauth/src/_pages/home/ui/HomePage.tsx): `apps/oauth/src/_pages/home/ui/HomePage.tsx`
- [Projects page](https://github.com/themoment-team/datagsm-client-v2/blob/main/apps/projects/src/_pages/home/ui/HomePage.tsx): `apps/projects/src/_pages/home/ui/HomePage.tsx`

### Authentication

- [Auth route handlers](https://github.com/themoment-team/datagsm-client-v2/blob/main/packages/core/src/shared/auth/authRoutes.ts): `packages/core/src/shared/auth/authRoutes.ts`
- [App auth routes](https://github.com/themoment-team/datagsm-client-v2/blob/main/apps/client/app/api/login/route.ts): `apps/client/app/api/login/route.ts`
- [Admin auth routes](https://github.com/themoment-team/datagsm-client-v2/blob/main/apps/admin/app/api/login/route.ts): `apps/admin/app/api/login/route.ts`
- [OAuth protocol](https://github.com/themoment-team/datagsm-client-v2/blob/main/packages/core/src/shared/auth/oauth.ts): `packages/core/src/shared/auth/oauth.ts`
- [Token cookies](https://github.com/themoment-team/datagsm-client-v2/blob/main/packages/core/src/shared/auth/cookies.ts): `packages/core/src/shared/auth/cookies.ts`
- [Token proxy](https://github.com/themoment-team/datagsm-client-v2/blob/main/packages/core/src/shared/auth/authProxy.ts): `packages/core/src/shared/auth/authProxy.ts`
- [Logout feature](https://github.com/themoment-team/datagsm-client-v2/blob/main/packages/core/src/features/logout/api/endIdpSession.ts): `packages/core/src/features/logout/api/endIdpSession.ts`

### Shared runtime

- [API client](https://github.com/themoment-team/datagsm-client-v2/blob/main/packages/core/src/shared/api/createApiInstance.ts): `packages/core/src/shared/api/createApiInstance.ts`
- [API interceptors](https://github.com/themoment-team/datagsm-client-v2/blob/main/packages/core/src/shared/api/interceptors.ts): `packages/core/src/shared/api/interceptors.ts`
- [Authenticated API clients](https://github.com/themoment-team/datagsm-client-v2/blob/main/apps/client/src/shared/api/server.ts): `apps/client/src/shared/api/server.ts`
- [Browser API clients](https://github.com/themoment-team/datagsm-client-v2/blob/main/apps/client/src/shared/api/client.ts): `apps/client/src/shared/api/client.ts`
- [App configuration](https://github.com/themoment-team/datagsm-client-v2/blob/main/packages/core/src/shared/config/appEnv.ts): `packages/core/src/shared/config/appEnv.ts`
- [App URLs](https://github.com/themoment-team/datagsm-client-v2/blob/main/packages/core/src/shared/config/appUrls.ts): `packages/core/src/shared/config/appUrls.ts`
- [OAuth configuration](https://github.com/themoment-team/datagsm-client-v2/blob/main/packages/core/src/shared/config/oauthEnv.ts): `packages/core/src/shared/config/oauthEnv.ts`
- [App shell](https://github.com/themoment-team/datagsm-client-v2/blob/main/packages/core/src/widgets/app-shell/ui/AppShell.tsx): `packages/core/src/widgets/app-shell/ui/AppShell.tsx`
- [App sidebar](https://github.com/themoment-team/datagsm-client-v2/blob/main/packages/core/src/widgets/app-shell/ui/AppSidebar.tsx): `packages/core/src/widgets/app-shell/ui/AppSidebar.tsx`

### Service status

- [Status page](https://github.com/themoment-team/datagsm-client-v2/blob/main/apps/status/src/_pages/home/ui/HomePage.tsx): `apps/status/src/_pages/home/ui/HomePage.tsx`
- [Status checks](https://github.com/themoment-team/datagsm-client-v2/blob/main/apps/status/src/_pages/home/api/checkServerStatus.ts): `apps/status/src/_pages/home/api/checkServerStatus.ts`
- [Status list](https://github.com/themoment-team/datagsm-client-v2/blob/main/apps/status/src/_pages/home/ui/ServerStatusList.tsx): `apps/status/src/_pages/home/ui/ServerStatusList.tsx`
- [Monitored servers](https://github.com/themoment-team/datagsm-client-v2/blob/main/apps/status/src/_pages/home/config/monitoredServers.ts): `apps/status/src/_pages/home/config/monitoredServers.ts`

### Other components

- **Browser user**
- **DataGSM API**
- **Authorization server**

## Connections

- Browser user → User web app: uses (evidence: `README.md`)
- Browser user → Admin web app: uses (evidence: `README.md`)
- Browser user → OAuth screen: uses (evidence: `README.md`)
- Browser user → Projects page: uses (evidence: `README.md`)
- Browser user → Status page: views (evidence: `README.md`)
- User web app → App auth routes: starts login
- Admin web app → Admin auth routes: starts login
- App auth routes → Auth route handlers: delegates
- Admin auth routes → Auth route handlers: delegates
- Auth route handlers → OAuth protocol: builds and exchanges (evidence: `packages/core/src/shared/auth/authRoutes.ts`)
- Auth route handlers → Token cookies: sets and clears (evidence: `packages/core/src/shared/auth/authRoutes.ts`)
- OAuth protocol → Authorization server: requests authorization and tokens (evidence: `packages/core/src/shared/auth/oauth.ts`)
- OAuth screen → Authorization server: provides login screen (evidence: `README.md`)
- User web app → Authenticated API clients: uses
- Admin web app → Authenticated API clients: uses
- Authenticated API clients → API client: creates client (evidence: `apps/client/src/shared/api/server.ts`)
- Authenticated API clients → Token proxy: attaches access token (evidence: `apps/client/src/shared/api/server.ts`)
- Browser API clients → API client: creates client (evidence: `apps/client/src/shared/api/client.ts`)
- Browser API clients → API interceptors: registers unauthorized handler (evidence: `apps/client/src/shared/api/client.ts`)
- User web app → Browser API clients: uses
- Authenticated API clients → DataGSM API: sends API requests
- User web app → App shell: renders
- Admin web app → App shell: renders
- App shell → App sidebar: renders
- App configuration → OAuth configuration: validates base settings (evidence: `packages/core/src/shared/config/oauthEnv.ts`)
- App configuration → App URLs: exports URL settings (evidence: `packages/core/src/shared/config/index.ts`)
- Status page → Status list: renders
- Status list → Status checks: checks status
- Status checks → Monitored servers: checks configured servers
- Logout feature → Authorization server: ends IdP session
