# salimnura77/tid-backend architecture

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

- Interactive diagram: https://gitdiagram.com/salimnura77/tid-backend
- Repository: https://github.com/salimnura77/tid-backend

## Overview

TrueID is a consent-first identity backend: an authenticated user creates or resumes an account, completes a verification, and can issue or manage credentials; a partner can request verification metadata only after an invitation and explicit user approval. The graph also preserves partner credential permissions, pairwise identifiers, consent history, health, and the prepared-but-disabled Monnify boundary. Evidence is limited to the README and shown/indexed source; credentials are documented but their source directory is absent from the supplied tree.

Main entry points: [`src/consent/consent.service.ts`](https://github.com/salimnura77/tid-backend/blob/main/src/consent/consent.service.ts) (Consent workflow), [`src/app.module.ts`](https://github.com/salimnura77/tid-backend/blob/main/src/app.module.ts) (App composition), [`src/verification/verification.service.ts`](https://github.com/salimnura77/tid-backend/blob/main/src/verification/verification.service.ts) (Verification service), [`src/partners/partners.service.ts`](https://github.com/salimnura77/tid-backend/blob/main/src/partners/partners.service.ts) (Partner registry)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["API and authentication"]
  node_http["HTTP setup<br/>[configure-http.ts]"]
  node_auth_guard["Auth guard<br/>[auth.guard.ts]"]
  node_token_verifier["Auth0 verifier"]
end

subgraph group_identity["Identity workflows"]
  node_users["Account routes"]
  node_account_access["Account access"]
  node_verification_api["Verification routes"]
  node_verification_service["Verification service"]
  node_provider_boundary["Provider boundary"]
  node_qoreid_adapter["QoreID adapter<br/>[qoreid-provider.ts]"]
  node_monnify_adapter["Monnify adapter"]
  node_credentials["Credential lifecycle"]
end

subgraph group_sharing["Partner consent"]
  node_partners["Partner registry"]
  node_consent_api["Consent routes"]
  node_consent_service["Consent workflow<br/>[consent.service.ts]"]
  node_consent_repo["Consent records"]
end

subgraph group_platform["Platform services"]
  node_app["App composition<br/>[app.module.ts]"]
  node_audit["Lifecycle audit<br/>[audit.service.ts]"]
  node_database["Database service"]
  node_config["Runtime configuration<br/>[runtime-config.ts]"]
  node_health["Health routes"]
end

node_mobile_user(("Mobile user"))
node_partner_client(("Partner client"))
node_auth0{{"Auth0 tenant"}}
node_qoreid{{"QoreID Test"}}
node_postgres[("PostgreSQL")]

node_app -->|"registers"| node_auth_guard
node_app -->|"registers"| node_users
node_app -->|"registers"| node_verification_api
node_app -->|"registers"| node_partners
node_app -->|"registers"| node_consent_api
node_app -->|"registers"| node_audit
node_mobile_user -.->|"sends requests"| node_http
node_partner_client -.->|"sends requests"| node_http
node_http -->|"starts application"| node_app
node_auth_guard -->|"verifies token"| node_token_verifier
node_auth_guard -->|"authenticates partner"| node_partners
node_auth0 -.->|"issues tokens"| node_token_verifier
node_users -.->|"resolves account"| node_account_access
node_verification_api -->|"dispatches"| node_verification_service
node_verification_service -->|"checks ownership"| node_account_access
node_verification_service -->|"uses provider"| node_provider_boundary
node_verification_service -.->|"enables issuance"| node_credentials
node_provider_boundary -.->|"selects provider"| node_qoreid_adapter
node_qoreid_adapter -.->|"calls verification"| node_qoreid
node_provider_boundary -.->|"selects provider"| node_monnify_adapter
node_partners -->|"queries partner data"| node_postgres
node_consent_api -->|"dispatches"| node_consent_service
node_consent_service -->|"checks account"| node_account_access
node_consent_service -->|"checks partner"| node_partners
node_consent_service -->|"reads and writes"| node_consent_repo
node_consent_service -->|"checks credential"| node_credentials
node_consent_service -->|"records events"| node_audit
node_consent_service -.->|"returns disclosure"| node_partner_client
node_consent_repo -.->|"queries consent data"| node_postgres
node_audit -->|"writes audit events"| node_postgres
node_database -->|"manages connections"| node_postgres
node_database -->|"uses settings"| node_config
node_health -->|"checks readiness"| node_database

click node_app "https://github.com/salimnura77/tid-backend/blob/main/src/app.module.ts"
click node_http "https://github.com/salimnura77/tid-backend/blob/main/src/http/configure-http.ts"
click node_auth_guard "https://github.com/salimnura77/tid-backend/blob/main/src/auth/auth.guard.ts"
click node_token_verifier "https://github.com/salimnura77/tid-backend/blob/main/src/auth/auth0-token-verifier.ts"
click node_users "https://github.com/salimnura77/tid-backend/blob/main/src/users/users.controller.ts"
click node_account_access "https://github.com/salimnura77/tid-backend/blob/main/src/users/account-access.service.ts"
click node_verification_api "https://github.com/salimnura77/tid-backend/blob/main/src/verification/verification.controller.ts"
click node_verification_service "https://github.com/salimnura77/tid-backend/blob/main/src/verification/verification.service.ts"
click node_provider_boundary "https://github.com/salimnura77/tid-backend/blob/main/src/verification/verification.provider.ts"
click node_qoreid_adapter "https://github.com/salimnura77/tid-backend/blob/main/src/verification/qoreid-provider.ts"
click node_monnify_adapter "https://github.com/salimnura77/tid-backend/blob/main/src/verification/monnify-provider.ts"
click node_partners "https://github.com/salimnura77/tid-backend/blob/main/src/partners/partners.service.ts"
click node_consent_api "https://github.com/salimnura77/tid-backend/blob/main/src/consent/consent.controller.ts"
click node_consent_service "https://github.com/salimnura77/tid-backend/blob/main/src/consent/consent.service.ts"
click node_consent_repo "https://github.com/salimnura77/tid-backend/blob/main/src/consent/consent.repository.ts"
click node_audit "https://github.com/salimnura77/tid-backend/blob/main/src/audit/audit.service.ts"
click node_database "https://github.com/salimnura77/tid-backend/blob/main/src/database/database.service.ts"
click node_config "https://github.com/salimnura77/tid-backend/blob/main/src/config/runtime-config.ts"
click node_health "https://github.com/salimnura77/tid-backend/blob/main/src/health/health.controller.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_http,node_auth_guard,node_token_verifier,node_mobile_user,node_partner_client toneBlue
class node_users,node_account_access,node_verification_api,node_verification_service,node_provider_boundary,node_qoreid_adapter,node_monnify_adapter,node_credentials,node_postgres toneAmber
class node_partners,node_consent_api,node_consent_service,node_consent_repo toneMint
class node_app,node_audit,node_database,node_config,node_health toneRose
class node_auth0,node_qoreid toneIndigo
```

## Components

### API and authentication

- [HTTP setup](https://github.com/salimnura77/tid-backend/blob/main/src/http/configure-http.ts): `src/http/configure-http.ts`
- [Auth guard](https://github.com/salimnura77/tid-backend/blob/main/src/auth/auth.guard.ts): `src/auth/auth.guard.ts`
- [Auth0 verifier](https://github.com/salimnura77/tid-backend/blob/main/src/auth/auth0-token-verifier.ts): `src/auth/auth0-token-verifier.ts`

### Identity workflows

- [Account routes](https://github.com/salimnura77/tid-backend/blob/main/src/users/users.controller.ts): `src/users/users.controller.ts`
- [Account access](https://github.com/salimnura77/tid-backend/blob/main/src/users/account-access.service.ts): `src/users/account-access.service.ts`
- [Verification routes](https://github.com/salimnura77/tid-backend/blob/main/src/verification/verification.controller.ts): `src/verification/verification.controller.ts`
- [Verification service](https://github.com/salimnura77/tid-backend/blob/main/src/verification/verification.service.ts): `src/verification/verification.service.ts`
- [Provider boundary](https://github.com/salimnura77/tid-backend/blob/main/src/verification/verification.provider.ts): `src/verification/verification.provider.ts`
- [QoreID adapter](https://github.com/salimnura77/tid-backend/blob/main/src/verification/qoreid-provider.ts): `src/verification/qoreid-provider.ts`
- [Monnify adapter](https://github.com/salimnura77/tid-backend/blob/main/src/verification/monnify-provider.ts): `src/verification/monnify-provider.ts`
- **Credential lifecycle**

### Partner consent

- [Partner registry](https://github.com/salimnura77/tid-backend/blob/main/src/partners/partners.service.ts): `src/partners/partners.service.ts`
- [Consent routes](https://github.com/salimnura77/tid-backend/blob/main/src/consent/consent.controller.ts): `src/consent/consent.controller.ts`
- [Consent workflow](https://github.com/salimnura77/tid-backend/blob/main/src/consent/consent.service.ts): `src/consent/consent.service.ts`
- [Consent records](https://github.com/salimnura77/tid-backend/blob/main/src/consent/consent.repository.ts): `src/consent/consent.repository.ts`

### Platform services

- [App composition](https://github.com/salimnura77/tid-backend/blob/main/src/app.module.ts): `src/app.module.ts`
- [Lifecycle audit](https://github.com/salimnura77/tid-backend/blob/main/src/audit/audit.service.ts): `src/audit/audit.service.ts`
- [Database service](https://github.com/salimnura77/tid-backend/blob/main/src/database/database.service.ts): `src/database/database.service.ts`
- [Runtime configuration](https://github.com/salimnura77/tid-backend/blob/main/src/config/runtime-config.ts): `src/config/runtime-config.ts`
- [Health routes](https://github.com/salimnura77/tid-backend/blob/main/src/health/health.controller.ts): `src/health/health.controller.ts`

### Other components

- **Mobile user**
- **Partner client**
- **Auth0 tenant**
- **QoreID Test**
- **PostgreSQL**

## Connections

- App composition → Auth guard: registers (evidence: `src/app.module.ts`)
- App composition → Account routes: registers (evidence: `src/app.module.ts`)
- App composition → Verification routes: registers (evidence: `src/app.module.ts`)
- App composition → Partner registry: registers (evidence: `src/app.module.ts`)
- App composition → Consent routes: registers (evidence: `src/app.module.ts`)
- App composition → Lifecycle audit: registers (evidence: `src/app.module.ts`)
- Mobile user → HTTP setup: sends requests (evidence: `README.md`)
- Partner client → HTTP setup: sends requests (evidence: `README.md`)
- HTTP setup → App composition: starts application (evidence: `src/main.ts`)
- Auth guard → Auth0 verifier: verifies token (evidence: `src/auth/auth.guard.ts`)
- Auth guard → Partner registry: authenticates partner (evidence: `src/auth/auth.guard.ts`)
- Auth0 tenant → Auth0 verifier: issues tokens (evidence: `README.md`)
- Account routes → Account access: resolves account (evidence: `src/users/account-access.service.ts`)
- Verification routes → Verification service: dispatches (evidence: `src/verification/verification.controller.ts`)
- Verification service → Account access: checks ownership (evidence: `src/verification/verification.service.ts`)
- Verification service → Provider boundary: uses provider (evidence: `src/verification/verification.service.ts`)
- Verification service → Credential lifecycle: enables issuance (evidence: `README.md`)
- Provider boundary → QoreID adapter: selects provider
- QoreID adapter → QoreID Test: calls verification (evidence: `README.md`)
- Provider boundary → Monnify adapter: selects provider
- Partner registry → PostgreSQL: queries partner data (evidence: `src/partners/partners.service.ts`)
- Consent routes → Consent workflow: dispatches (evidence: `src/consent/consent.controller.ts`)
- Consent workflow → Account access: checks account (evidence: `src/consent/consent.service.ts`)
- Consent workflow → Partner registry: checks partner (evidence: `src/consent/consent.service.ts`)
- Consent workflow → Consent records: reads and writes (evidence: `src/consent/consent.service.ts`)
- Consent workflow → Credential lifecycle: checks credential (evidence: `src/consent/consent.service.ts`)
- Consent workflow → Lifecycle audit: records events (evidence: `src/consent/consent.service.ts`)
- Consent workflow → Partner client: returns disclosure (evidence: `README.md`)
- Consent records → PostgreSQL: queries consent data (evidence: `src/consent/consent.repository.ts`)
- Lifecycle audit → PostgreSQL: writes audit events (evidence: `src/audit/audit.service.ts`)
- Database service → PostgreSQL: manages connections (evidence: `src/database/database.service.ts`)
- Database service → Runtime configuration: uses settings (evidence: `src/database/database.service.ts`)
- Health routes → Database service: checks readiness (evidence: `src/health/health.controller.ts`)
