# doko89/identityhub architecture

> Architecture diagram of the GitHub repository doko89/identityhub, 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/doko89/identityhub
- Repository: https://github.com/doko89/identityhub

## Overview

IdentityHub is a single-tenant identity provider for local and LDAP-backed users, with browser login, MFA, OIDC/SAML SSO, legacy LDAP/RADIUS authentication, an app dashboard, and administration. The main user flow is a login request through HTTP or a legacy listener, shared authentication and optional MFA, then a session or protocol response; admin workflows manage users, groups, applications, providers, and branding. The README documents several capabilities whose implementation details were not sampled, so those branches are shown at subsystem level. Dashed links mark documented or likely integration points not directly shown in excerpts.

Main entry points: [`internal/delivery/http/handlers.go`](https://github.com/doko89/identityhub/blob/main/internal/delivery/http/handlers.go) (HTTP API), [`web/src/app/App.tsx`](https://github.com/doko89/identityhub/blob/main/web/src/app/App.tsx) (Browser app), [`internal/usecase/auth/service.go`](https://github.com/doko89/identityhub/blob/main/internal/usecase/auth/service.go) (Authentication), [`cmd/identityhub/main.go`](https://github.com/doko89/identityhub/blob/main/cmd/identityhub/main.go) (IdentityHub runtime)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Runtime and API"]
  node_identityhub["IdentityHub runtime<br/>[main.go]"]
  node_http["HTTP API<br/>[handlers.go]"]
end

subgraph group_identity["Identity and Access"]
  node_auth["Authentication<br/>[service.go]"]
  node_directory["LDAP directory client<br/>[client.go]"]
  node_mfa["MFA policy<br/>[service.go]"]
end

subgraph group_federation["Federation and Legacy"]
  node_oidc["OIDC flow<br/>[service.go]"]
  node_saml["SAML flow<br/>[service.go]"]
  node_ldapserver["LDAP listener<br/>[server.go]"]
  node_radius["RADIUS listener<br/>[server.go]"]
end

subgraph group_management["Management and Data"]
  node_useradmin["User and group service<br/>[service.go]"]
  node_apps["App catalog<br/>[service.go]"]
  node_audit["Audit service<br/>[service.go]"]
  node_postgres[("Postgres persistence<br/>[user_repository.go]")]
end

subgraph group_web["Browser Experience"]
  node_webapp["Browser app<br/>[App.tsx]"]
  node_dashboard["App dashboard<br/>[DashboardPage.tsx]"]
  node_adminui["Admin console<br/>[AdminUsersPage.tsx]"]
  node_branding["Branding<br/>[BrandProvider.tsx]"]
end

node_person(("User or admin"))
node_client["OIDC/SAML client"]
node_nas["Legacy client"]

node_person -->|"uses"| node_webapp
node_webapp -.->|"requests API"| node_http
node_identityhub -->|"serves"| node_http
node_person -->|"logs in"| node_http
node_http -->|"authenticates"| node_auth
node_auth -->|"binds upstream"| node_directory
node_auth -.->|"checks policy"| node_mfa
node_http -->|"verifies factor"| node_mfa
node_http -->|"manages users"| node_useradmin
node_http -->|"handles OIDC"| node_oidc
node_http -->|"handles SAML"| node_saml
node_client -->|"starts SSO"| node_http
node_nas -->|"binds or searches"| node_ldapserver
node_ldapserver -->|"authenticates binds"| node_auth
node_nas -->|"sends PAP"| node_radius
node_radius -->|"authenticates PAP"| node_auth
node_http -->|"manages catalog"| node_apps
node_http -.->|"records activity"| node_audit
node_webapp -->|"routes to"| node_dashboard
node_webapp -->|"routes to"| node_adminui
node_webapp -.->|"provides theme"| node_branding
node_identityhub -.->|"wires persistence"| node_postgres

click node_identityhub "https://github.com/doko89/identityhub/blob/main/cmd/identityhub/main.go"
click node_http "https://github.com/doko89/identityhub/blob/main/internal/delivery/http/handlers.go"
click node_webapp "https://github.com/doko89/identityhub/blob/main/web/src/app/App.tsx"
click node_auth "https://github.com/doko89/identityhub/blob/main/internal/usecase/auth/service.go"
click node_directory "https://github.com/doko89/identityhub/blob/main/internal/adapter/ldapclient/client.go"
click node_mfa "https://github.com/doko89/identityhub/blob/main/internal/usecase/mfa/service.go"
click node_useradmin "https://github.com/doko89/identityhub/blob/main/internal/usecase/user/service.go"
click node_oidc "https://github.com/doko89/identityhub/blob/main/internal/usecase/oidcflow/service.go"
click node_saml "https://github.com/doko89/identityhub/blob/main/internal/usecase/samlflow/service.go"
click node_ldapserver "https://github.com/doko89/identityhub/blob/main/internal/delivery/ldap/server.go"
click node_radius "https://github.com/doko89/identityhub/blob/main/internal/delivery/radius/server.go"
click node_apps "https://github.com/doko89/identityhub/blob/main/internal/usecase/app/service.go"
click node_audit "https://github.com/doko89/identityhub/blob/main/internal/usecase/audit/service.go"
click node_postgres "https://github.com/doko89/identityhub/blob/main/internal/adapter/postgres/user_repository.go"
click node_dashboard "https://github.com/doko89/identityhub/blob/main/web/src/features/dashboard/pages/DashboardPage.tsx"
click node_adminui "https://github.com/doko89/identityhub/blob/main/web/src/features/admin/pages/AdminUsersPage.tsx"
click node_branding "https://github.com/doko89/identityhub/blob/main/web/src/features/branding/BrandProvider.tsx"

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_identityhub,node_http,node_person,node_client,node_nas toneBlue
class node_auth,node_directory,node_mfa toneAmber
class node_oidc,node_saml,node_ldapserver,node_radius toneMint
class node_useradmin,node_apps,node_audit,node_postgres toneRose
class node_webapp,node_dashboard,node_adminui,node_branding toneIndigo
```

## Components

### Runtime and API

- [IdentityHub runtime](https://github.com/doko89/identityhub/blob/main/cmd/identityhub/main.go): `cmd/identityhub/main.go`
- [HTTP API](https://github.com/doko89/identityhub/blob/main/internal/delivery/http/handlers.go): `internal/delivery/http/handlers.go`

### Identity and Access

- [Authentication](https://github.com/doko89/identityhub/blob/main/internal/usecase/auth/service.go): `internal/usecase/auth/service.go`
- [LDAP directory client](https://github.com/doko89/identityhub/blob/main/internal/adapter/ldapclient/client.go): `internal/adapter/ldapclient/client.go`
- [MFA policy](https://github.com/doko89/identityhub/blob/main/internal/usecase/mfa/service.go): `internal/usecase/mfa/service.go`

### Federation and Legacy

- [OIDC flow](https://github.com/doko89/identityhub/blob/main/internal/usecase/oidcflow/service.go): `internal/usecase/oidcflow/service.go`
- [SAML flow](https://github.com/doko89/identityhub/blob/main/internal/usecase/samlflow/service.go): `internal/usecase/samlflow/service.go`
- [LDAP listener](https://github.com/doko89/identityhub/blob/main/internal/delivery/ldap/server.go): `internal/delivery/ldap/server.go`
- [RADIUS listener](https://github.com/doko89/identityhub/blob/main/internal/delivery/radius/server.go): `internal/delivery/radius/server.go`

### Management and Data

- [User and group service](https://github.com/doko89/identityhub/blob/main/internal/usecase/user/service.go): `internal/usecase/user/service.go`
- [App catalog](https://github.com/doko89/identityhub/blob/main/internal/usecase/app/service.go): `internal/usecase/app/service.go`
- [Audit service](https://github.com/doko89/identityhub/blob/main/internal/usecase/audit/service.go): `internal/usecase/audit/service.go`
- [Postgres persistence](https://github.com/doko89/identityhub/blob/main/internal/adapter/postgres/user_repository.go): `internal/adapter/postgres/user_repository.go`

### Browser Experience

- [Browser app](https://github.com/doko89/identityhub/blob/main/web/src/app/App.tsx): `web/src/app/App.tsx`
- [App dashboard](https://github.com/doko89/identityhub/blob/main/web/src/features/dashboard/pages/DashboardPage.tsx): `web/src/features/dashboard/pages/DashboardPage.tsx`
- [Admin console](https://github.com/doko89/identityhub/blob/main/web/src/features/admin/pages/AdminUsersPage.tsx): `web/src/features/admin/pages/AdminUsersPage.tsx`
- [Branding](https://github.com/doko89/identityhub/blob/main/web/src/features/branding/BrandProvider.tsx): `web/src/features/branding/BrandProvider.tsx`

### Other components

- **User or admin**
- **OIDC/SAML client**
- **Legacy client**

## Connections

- User or admin → Browser app: uses (evidence: `README.md`)
- Browser app → HTTP API: requests API
- IdentityHub runtime → HTTP API: serves (evidence: `cmd/identityhub/main.go`)
- User or admin → HTTP API: logs in (evidence: `README.md`)
- HTTP API → Authentication: authenticates (evidence: `internal/delivery/http/handlers.go`)
- Authentication → LDAP directory client: binds upstream (evidence: `internal/adapter/ldapclient/client.go`)
- Authentication → MFA policy: checks policy
- HTTP API → MFA policy: verifies factor (evidence: `internal/delivery/http/handlers.go`)
- HTTP API → User and group service: manages users (evidence: `internal/delivery/http/handlers.go`)
- HTTP API → OIDC flow: handles OIDC (evidence: `internal/delivery/http/handlers.go`)
- HTTP API → SAML flow: handles SAML (evidence: `internal/delivery/http/handlers.go`)
- OIDC/SAML client → HTTP API: starts SSO (evidence: `README.md`)
- Legacy client → LDAP listener: binds or searches (evidence: `README.md`)
- LDAP listener → Authentication: authenticates binds (evidence: `internal/delivery/ldap/server.go`)
- Legacy client → RADIUS listener: sends PAP (evidence: `README.md`)
- RADIUS listener → Authentication: authenticates PAP (evidence: `internal/delivery/radius/server.go`)
- HTTP API → App catalog: manages catalog
- HTTP API → Audit service: records activity
- Browser app → App dashboard: routes to (evidence: `web/src/app/App.tsx`)
- Browser app → Admin console: routes to (evidence: `web/src/app/App.tsx`)
- Browser app → Branding: provides theme
- IdentityHub runtime → Postgres persistence: wires persistence
