# credebl/platform architecture

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

- Interactive diagram: https://gitdiagram.com/credebl/platform
- Repository: https://github.com/credebl/platform

## Overview

CREDEBL is a backend SSI platform. A user authenticates through the API Gateway, selects an organization or ecosystem, and invokes wallet, connection, credential-issuance, or verification operations. The gateway dispatches requests over NATS to dedicated microservices, which manage agent interactions and persistence before returning API results. The graph preserves organization/ecosystem administration, OID4VC flows, notifications, and file storage as major branches. Some gateway-to-service wiring is inferred only from the README’s microservice/NATS description; unsampled implementation calls are omitted.

Main entry points: [`apps/api-gateway/src/app.module.ts`](https://github.com/credebl/platform/blob/main/apps/api-gateway/src/app.module.ts) (API Gateway), [`apps/agent-service/src/agent-service.service.ts`](https://github.com/credebl/platform/blob/main/apps/agent-service/src/agent-service.service.ts) (Agent Service), [`apps/issuance/src/issuance.service.ts`](https://github.com/credebl/platform/blob/main/apps/issuance/src/issuance.service.ts) (Issuance Service), [`apps/verification/src/verification.service.ts`](https://github.com/credebl/platform/blob/main/apps/verification/src/verification.service.ts) (Verification Service)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_access["Access Layer"]
  node_gateway["API Gateway<br/>[app.module.ts]"]
  node_authz["Authorization<br/>[authz.service.ts]"]
end

subgraph group_tenancy["Tenancy Management"]
  node_organization_api["Organization API"]
  node_organization_service["Organization Service"]
  node_organization_store[("Organization Store")]
  node_ecosystem_api["Ecosystem API"]
  node_ecosystem_service["Ecosystem Service"]
end

subgraph group_ssi["SSI Operations"]
  node_agent_api["Agent API<br/>[agent.service.ts]"]
  node_agent_controller["Agent Commands"]
  node_agent_service["Agent Service"]
  node_provisioning["Agent Provisioning"]
  node_connection_service["Connection Service"]
  node_cloud_wallet["Cloud Wallet"]
end

subgraph group_trust["Trust Workflows"]
  node_issuance_api["Issuance API"]
  node_issuance_service["Issuance Service"]
  node_verification_api["Verification API"]
  node_verification_service["Verification Service"]
  node_oid4vc_verifier["OID4VC Verification"]
  node_oid4vc_issuer["OID4VC Issuance"]
  node_ledger["Ledger Service<br/>[ledger.service.ts]"]
  node_schema["Schema Service<br/>[schema.service.ts]"]
end

subgraph group_platform["Platform Infrastructure"]
  node_nats["NATS Broker"]
  node_storage["File Storage<br/>[storage.service.ts]"]
  node_notifications["Notifications"]
  node_postgres[("PostgreSQL")]
end

node_user(("Platform User"))

node_user -->|"submits requests"| node_gateway
node_gateway -->|"authorizes"| node_authz
node_gateway -->|"dispatches commands"| node_nats
node_nats -->|"delivers commands"| node_organization_api
node_organization_api -->|"calls service"| node_organization_service
node_organization_service -->|"reads and writes"| node_organization_store
node_organization_store -->|"persists data"| node_postgres
node_nats -->|"delivers commands"| node_ecosystem_service
node_ecosystem_service -->|"persists data"| node_postgres
node_gateway -->|"routes agent calls"| node_agent_api
node_agent_api -->|"dispatches commands"| node_nats
node_nats -->|"delivers commands"| node_agent_controller
node_agent_controller -->|"calls service"| node_agent_service
node_agent_service -->|"provisions agents"| node_provisioning
node_agent_service -->|"manages connections"| node_connection_service
node_agent_service -->|"manages wallets"| node_cloud_wallet
node_issuance_api -->|"calls service"| node_issuance_service
node_issuance_service -->|"uses agent"| node_agent_service
node_issuance_service -->|"uses ledger"| node_ledger
node_verification_api -->|"calls service"| node_verification_service
node_verification_service -->|"uses agent"| node_agent_service
node_gateway -.->|"routes issuer calls"| node_oid4vc_issuer
node_gateway -.->|"routes verifier calls"| node_oid4vc_verifier
node_ledger -->|"manages schemas"| node_schema
node_issuance_service -.->|"stores files"| node_storage
node_verification_service -.->|"emits notifications"| node_notifications

click node_gateway "https://github.com/credebl/platform/blob/main/apps/api-gateway/src/app.module.ts"
click node_authz "https://github.com/credebl/platform/blob/main/apps/api-gateway/src/authz/authz.service.ts"
click node_organization_api "https://github.com/credebl/platform/blob/main/apps/api-gateway/src/organization/organization.controller.ts"
click node_organization_service "https://github.com/credebl/platform/blob/main/apps/organization/src/organization.service.ts"
click node_organization_store "https://github.com/credebl/platform/blob/main/apps/organization/repositories/organization.repository.ts"
click node_ecosystem_api "https://github.com/credebl/platform/blob/main/apps/api-gateway/src/ecosystem/ecosystem.controller.ts"
click node_ecosystem_service "https://github.com/credebl/platform/blob/main/apps/ecosystem/src/ecosystem.service.ts"
click node_agent_api "https://github.com/credebl/platform/blob/main/apps/api-gateway/src/agent/agent.service.ts"
click node_agent_controller "https://github.com/credebl/platform/blob/main/apps/agent-service/src/agent-service.controller.ts"
click node_agent_service "https://github.com/credebl/platform/blob/main/apps/agent-service/src/agent-service.service.ts"
click node_provisioning "https://github.com/credebl/platform/blob/main/apps/agent-provisioning/src/agent-provisioning.service.ts"
click node_connection_service "https://github.com/credebl/platform/blob/main/apps/connection/src/connection.service.ts"
click node_cloud_wallet "https://github.com/credebl/platform/blob/main/apps/cloud-wallet/src/cloud-wallet.service.ts"
click node_issuance_api "https://github.com/credebl/platform/blob/main/apps/api-gateway/src/issuance/issuance.controller.ts"
click node_issuance_service "https://github.com/credebl/platform/blob/main/apps/issuance/src/issuance.service.ts"
click node_verification_api "https://github.com/credebl/platform/blob/main/apps/api-gateway/src/verification/verification.controller.ts"
click node_verification_service "https://github.com/credebl/platform/blob/main/apps/verification/src/verification.service.ts"
click node_oid4vc_verifier "https://github.com/credebl/platform/blob/main/apps/oid4vc-verification/src/oid4vc-verification.service.ts"
click node_oid4vc_issuer "https://github.com/credebl/platform/blob/main/apps/oid4vc-issuance/src/oid4vc-issuance.service.ts"
click node_ledger "https://github.com/credebl/platform/blob/main/apps/ledger/src/ledger.service.ts"
click node_schema "https://github.com/credebl/platform/blob/main/apps/ledger/src/schema/schema.service.ts"
click node_storage "https://github.com/credebl/platform/blob/main/libs/storage/src/storage.service.ts"
click node_notifications "https://github.com/credebl/platform/blob/main/apps/notification/src/notification.service.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_gateway,node_authz,node_user toneBlue
class node_organization_api,node_organization_service,node_organization_store,node_ecosystem_api,node_ecosystem_service toneAmber
class node_agent_api,node_agent_controller,node_agent_service,node_provisioning,node_connection_service,node_cloud_wallet toneMint
class node_issuance_api,node_issuance_service,node_verification_api,node_verification_service,node_oid4vc_verifier,node_oid4vc_issuer,node_ledger,node_schema toneRose
class node_nats,node_storage,node_notifications,node_postgres toneIndigo
```

## Components

### Access Layer

- [API Gateway](https://github.com/credebl/platform/blob/main/apps/api-gateway/src/app.module.ts): `apps/api-gateway/src/app.module.ts`
- [Authorization](https://github.com/credebl/platform/blob/main/apps/api-gateway/src/authz/authz.service.ts): `apps/api-gateway/src/authz/authz.service.ts`

### Tenancy Management

- [Organization API](https://github.com/credebl/platform/blob/main/apps/api-gateway/src/organization/organization.controller.ts): `apps/api-gateway/src/organization/organization.controller.ts`
- [Organization Service](https://github.com/credebl/platform/blob/main/apps/organization/src/organization.service.ts): `apps/organization/src/organization.service.ts`
- [Organization Store](https://github.com/credebl/platform/blob/main/apps/organization/repositories/organization.repository.ts): `apps/organization/repositories/organization.repository.ts`
- [Ecosystem API](https://github.com/credebl/platform/blob/main/apps/api-gateway/src/ecosystem/ecosystem.controller.ts): `apps/api-gateway/src/ecosystem/ecosystem.controller.ts`
- [Ecosystem Service](https://github.com/credebl/platform/blob/main/apps/ecosystem/src/ecosystem.service.ts): `apps/ecosystem/src/ecosystem.service.ts`

### SSI Operations

- [Agent API](https://github.com/credebl/platform/blob/main/apps/api-gateway/src/agent/agent.service.ts): `apps/api-gateway/src/agent/agent.service.ts`
- [Agent Commands](https://github.com/credebl/platform/blob/main/apps/agent-service/src/agent-service.controller.ts): `apps/agent-service/src/agent-service.controller.ts`
- [Agent Service](https://github.com/credebl/platform/blob/main/apps/agent-service/src/agent-service.service.ts): `apps/agent-service/src/agent-service.service.ts`
- [Agent Provisioning](https://github.com/credebl/platform/blob/main/apps/agent-provisioning/src/agent-provisioning.service.ts): `apps/agent-provisioning/src/agent-provisioning.service.ts`
- [Connection Service](https://github.com/credebl/platform/blob/main/apps/connection/src/connection.service.ts): `apps/connection/src/connection.service.ts`
- [Cloud Wallet](https://github.com/credebl/platform/blob/main/apps/cloud-wallet/src/cloud-wallet.service.ts): `apps/cloud-wallet/src/cloud-wallet.service.ts`

### Trust Workflows

- [Issuance API](https://github.com/credebl/platform/blob/main/apps/api-gateway/src/issuance/issuance.controller.ts): `apps/api-gateway/src/issuance/issuance.controller.ts`
- [Issuance Service](https://github.com/credebl/platform/blob/main/apps/issuance/src/issuance.service.ts): `apps/issuance/src/issuance.service.ts`
- [Verification API](https://github.com/credebl/platform/blob/main/apps/api-gateway/src/verification/verification.controller.ts): `apps/api-gateway/src/verification/verification.controller.ts`
- [Verification Service](https://github.com/credebl/platform/blob/main/apps/verification/src/verification.service.ts): `apps/verification/src/verification.service.ts`
- [OID4VC Verification](https://github.com/credebl/platform/blob/main/apps/oid4vc-verification/src/oid4vc-verification.service.ts): `apps/oid4vc-verification/src/oid4vc-verification.service.ts`
- [OID4VC Issuance](https://github.com/credebl/platform/blob/main/apps/oid4vc-issuance/src/oid4vc-issuance.service.ts): `apps/oid4vc-issuance/src/oid4vc-issuance.service.ts`
- [Ledger Service](https://github.com/credebl/platform/blob/main/apps/ledger/src/ledger.service.ts): `apps/ledger/src/ledger.service.ts`
- [Schema Service](https://github.com/credebl/platform/blob/main/apps/ledger/src/schema/schema.service.ts): `apps/ledger/src/schema/schema.service.ts`

### Platform Infrastructure

- **NATS Broker**
- [File Storage](https://github.com/credebl/platform/blob/main/libs/storage/src/storage.service.ts): `libs/storage/src/storage.service.ts`
- [Notifications](https://github.com/credebl/platform/blob/main/apps/notification/src/notification.service.ts): `apps/notification/src/notification.service.ts`
- **PostgreSQL**

### Other components

- **Platform User**

## Connections

- Platform User → API Gateway: submits requests
- API Gateway → Authorization: authorizes
- API Gateway → NATS Broker: dispatches commands
- NATS Broker → Organization API: delivers commands
- Organization API → Organization Service: calls service
- Organization Service → Organization Store: reads and writes
- Organization Store → PostgreSQL: persists data
- NATS Broker → Ecosystem Service: delivers commands
- Ecosystem Service → PostgreSQL: persists data
- API Gateway → Agent API: routes agent calls
- Agent API → NATS Broker: dispatches commands
- NATS Broker → Agent Commands: delivers commands
- Agent Commands → Agent Service: calls service
- Agent Service → Agent Provisioning: provisions agents
- Agent Service → Connection Service: manages connections
- Agent Service → Cloud Wallet: manages wallets
- Issuance API → Issuance Service: calls service
- Issuance Service → Agent Service: uses agent
- Issuance Service → Ledger Service: uses ledger
- Verification API → Verification Service: calls service
- Verification Service → Agent Service: uses agent
- API Gateway → OID4VC Issuance: routes issuer calls
- API Gateway → OID4VC Verification: routes verifier calls
- Ledger Service → Schema Service: manages schemas
- Issuance Service → File Storage: stores files
- Verification Service → Notifications: emits notifications
