# 4sure-tech/bc-wallet-demo architecture

> Architecture diagram of the GitHub repository 4sure-tech/bc-wallet-demo, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-12). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/4sure-tech/bc-wallet-demo
- Repository: https://github.com/4sure-tech/bc-wallet-demo

## Overview

##### Project type and purpose
- This is a TypeScript monorepo for a full-stack “BC Wallet Demo” application. It showcases verifiable‐credential issuance and verification using multiple services.
- Key indicators:
- apps/bc-wallet-api-server (Node.js REST API + PostgreSQL)
- apps/bc-wallet-demo-server (Express demo back end)
- apps/bc-wallet-demo-web (React front end)
- apps/bc-wallet-showcase-creator (Next.js front end for managing showcases)
- apps/bc-wallet-traction-adapter (background adapter service)
- Helm charts, Dockerfiles, CI workflows under .github and charts/.

##### File structure
- Top-level “apps” folder contains 5 deployable services:
- bc-wallet-api-server
- bc-wallet-demo-server
- bc-wallet-demo-web
- bc-wallet-showcase-creator
- bc-wallet-traction-adapter
- “packages” contains shared libraries and OpenAPI definitions.
- “charts” holds Helm templates for each service plus ingress.
- Docker and docker-compose files for local dev and prod mimic the chart services.
- CI/CD: / .github/workflows and actions automate build/test and container scans.

##### README.md
- Confirms that it is a demo application: users walk through issuance & verification flows.

##### Essential architectural elements
- Do not overcrowd: focus on the five deployable apps, their data stores, and key external dependencies.
- If more granularity is needed, drill into bc-wallet-api-server internals showing controller → service → repository layers.
- Flow of credential issuance and verification is clearly traceable from UI → API → Indy → UI.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Frontend Clients
    subgraph "User Agents"
        direction TB
        DemoWeb["Demo Web UI<br/>(React)"]:::frontend
        ShowcaseCreator["Showcase Creator UI<br/>(Next.js)"]:::frontend
        BCWalletMobile["BC Wallet Mobile App"]:::external
    end

    %% Backend Services
    subgraph "Backend Services"
        direction TB
        DemoAPI["Demo API Server<br/>(Express)"]:::backend
        CredentialAPI["bc-wallet-api-server<br/>(Node.js + PostgreSQL)"]:::backend
        AdapterService["Traction Adapter Service<br/>(Worker)"]:::worker
    end

    %% Data Stores
    subgraph "Data & External Dependencies"
        direction TB
        PostgreSQL[(PostgreSQL)]:::db
        IndyPool[("Hyperledger Indy Pool")]:::external
        OIDCProvider["OIDC Provider"]:::external
        TractionEndpoint["Traction Analytics Endpoint"]:::external
    end

    %% Shared Packages
    subgraph "Shared Libraries & Specs"
        direction TB
        AdapterClient["Adapter Client Library"]:::shared
        OpenAPI_Credential["Credential OpenAPI Spec"]:::shared
        OpenAPI_Traction["Traction OpenAPI Spec"]:::shared
    end

    %% Deployment & CI/CD
    subgraph "Infrastructure & CI/CD"
        direction TB
        HelmCharts["Helm Charts"]:::chart
        DockerDev["Docker Compose (Dev)"]:::external
        DockerProd["Docker Compose (Prod)"]:::external
        CIWorkflows["CI/CD Workflows"]:::external
    end

    %% Relationships
    DemoWeb -->|"REST HTTP"| DemoAPI
    DemoWeb -->|"Deep link"| BCWalletMobile
    ShowcaseCreator -->|"REST HTTP"| ShowcaseCreator
    DemoAPI -->|"Session Auth"| OIDCProvider
    DemoAPI -->|"REST HTTP"| CredentialAPI
    CredentialAPI -->|"SQL via Drizzle"| PostgreSQL
    CredentialAPI -->|"Indy SDK"| IndyPool
    AdapterService -.->|"Webhooks/Polling"| CredentialAPI
    AdapterService -->|"HTTP POST"| TractionEndpoint
    DemoAPI -->|"uses"| AdapterClient
    CredentialAPI -->|"uses"| AdapterClient
    DemoAPI -->|"spec from"| OpenAPI_Credential
    AdapterService -->|"spec from"| OpenAPI_Traction

    %% Deployments
    CredentialAPI -->|"deployed via"| HelmCharts
    DemoAPI -->|"deployed via"| HelmCharts
    DemoWeb -->|"deployed via"| HelmCharts
    ShowcaseCreator -->|"deployed via"| HelmCharts
    AdapterService -->|"deployed via"| HelmCharts
    DockerDev -->|"local dev"| HelmCharts
    DockerProd -->|"prod env"| HelmCharts
    CIWorkflows -->|"CI/CD"| HelmCharts

    %% Click Events
    click DemoWeb "https://github.com/4sure-tech/bc-wallet-demo/tree/develop-4sure/apps/bc-wallet-demo-web"
    click ShowcaseCreator "https://github.com/4sure-tech/bc-wallet-demo/tree/develop-4sure/apps/bc-wallet-showcase-creator"
    click DemoAPI "https://github.com/4sure-tech/bc-wallet-demo/tree/develop-4sure/apps/bc-wallet-demo-server"
    click CredentialAPI "https://github.com/4sure-tech/bc-wallet-demo/tree/develop-4sure/apps/bc-wallet-api-server"
    click AdapterService "https://github.com/4sure-tech/bc-wallet-demo/tree/develop-4sure/apps/bc-wallet-traction-adapter"
    click AdapterClient "https://github.com/4sure-tech/bc-wallet-demo/tree/develop-4sure/packages/bc-wallet-adapter-client-api"
    click OpenAPI_Credential "https://github.com/4sure-tech/bc-wallet-demo/blob/develop-4sure/packages/bc-wallet-openapi/openapi/openapi.yaml"
    click OpenAPI_Traction "https://github.com/4sure-tech/bc-wallet-demo/blob/develop-4sure/packages/bc-wallet-traction-openapi/openapi/traction-openapi.yaml"
    click HelmCharts "https://github.com/4sure-tech/bc-wallet-demo/tree/develop-4sure/charts/bc-wallet/templates"
    click DockerDev "https://github.com/4sure-tech/bc-wallet-demo/blob/develop-4sure/docker/dev/docker-compose.yml"
    click DockerProd "https://github.com/4sure-tech/bc-wallet-demo/blob/develop-4sure/docker/prod/docker-compose.yml"
    click CIWorkflows "https://github.com/4sure-tech/bc-wallet-demo/tree/develop-4sure/.github/workflows"

    %% Styles
    classDef frontend fill:#D6EAF8,stroke:#1F618D,color:#1B4F72
    classDef backend fill:#D5F5E3,stroke:#27AE60,color:#145A32
    classDef worker fill:#E8DAEF,stroke:#8E44AD,color:#512E5F
    classDef db fill:#F9E79F,stroke:#B7950B,color:#7D6608
    classDef external fill:#D5D8DC,stroke:#7B7D7D,color:#424949
    classDef shared fill:#FADBD8,stroke:#CD6155,color:#78281F
    classDef chart fill:#FDEBD0,stroke:#B9770E,color:#6E2C00
```
