# technical-assignment-spherity/vc-wallet architecture

> Architecture diagram of the GitHub repository technical-assignment-spherity/vc-wallet, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-11-10). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/technical-assignment-spherity/vc-wallet
- Repository: https://github.com/technical-assignment-spherity/vc-wallet

## Overview

##### Project Type and Purpose
- This is a full-stack web application (“Verifiable Credential Wallet”) whose goal is to let users issue, store, share, display, and verify signed credentials.
- The frontend is a React/TypeScript Single-Page App; the backend is a NestJS/TypeScript REST API. Credentials are signed with JWT (HS256) and persisted to the local file system. Both sides are containerized via Docker Compose.

##### File Structure
- Top-level:
- docker-compose.yml, env.example, README.md
- backend/
- frontend/
- backend/:
- Dockerfile, NestJS config (nest-cli.json, tsconfig.json, ESLint/Prettier).
- src/app.module.ts wires modules.
- src/credentials ● controller, service, module, DTOs, entity.
- main.ts boots the NestJS HTTP server on port 3001.
- frontend/:
- Dockerfile, nginx.conf (serving built assets).
- public/index.html, src/index.tsx mounts React.
- src/components (CredentialForm, CredentialList, CredentialCard, CredentialVerifier).
- src/services/credentialService.ts calls the backend API.
- TypeScript config (tsconfig.json).
- Root-level docker-compose.yml orchestrates two services (backend:3001, frontend:3000).

##### README for Additional Insights
- Tech Stack summary aligns with the file structure.
- Environment variables: JWT_SECRET, PORT, FRONTEND_URL.
- Local development (npm scripts) vs. containerized deployment.
- API endpoints under /credentials for CRUD + verify.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Orchestrator and Config
    subgraph "Docker Compose Orchestrator" 
        direction TB
        DockerCompose["docker-compose.yml"]:::infra
        EnvExample["env.example"]:::config
    end

    %% Frontend Service
    subgraph "Frontend Container (Port 3000)"
        direction TB
        DockerfileFE["Dockerfile"]:::infra
        subgraph "nginx Reverse Proxy"
            Nginx["nginx.conf"]:::infra
        end
        subgraph "React SPA"
            direction TB
            Index["index.tsx"]:::frontend
            App["App.tsx"]:::frontend
            CF["CredentialForm.tsx"]:::frontend
            CL["CredentialList.tsx"]:::frontend
            CC["CredentialCard.tsx"]:::frontend
            CV["CredentialVerifier.tsx"]:::frontend
            ServiceFE["credentialService.ts"]:::frontend
        end
    end

    %% Backend Service
    subgraph "Backend Container (Port 3001)"
        direction TB
        DockerfileBE["Dockerfile"]:::infra
        CliConfig["nest-cli.json"]:::config
        TsConfigBE["tsconfig.json"]:::config
        main["main.ts"]:::backend
        AppModule["app.module.ts"]:::backend
        subgraph "Credentials Module"
            direction TB
            Module["credentials.module.ts"]:::backend
            Controller["credentials.controller.ts"]:::backend
            ServiceBE["credentials.service.ts"]:::backend
            DTO1["create-credential.dto.ts"]:::backend
            DTO2["verify-credential.dto.ts"]:::backend
            Entity["credential.entity.ts"]:::backend
        end
    end

    %% Infrastructure Components
    FileStore["File System Storage"]:::infra
    JWTEngine["JWT Signing Engine"]:::infra
    EnvSecret["JWT_SECRET (env var)"]:::config
    User["User (Browser)"]:::external

    %% Relationships
    User -->|"GET SPA"| Nginx
    Nginx -->|"serves static assets"| Index
    Index --> App
    App --> CF
    App --> CL
    App --> CC
    App --> CV
    App -->|"uses"| ServiceFE
    ServiceFE -->|"HTTP REST"| Controller
    Controller -->|"invokes"| ServiceBE
    ServiceBE -->|"writes/read JSON"| FileStore
    ServiceBE -->|"signs/verifies"| JWTEngine
    ServiceBE --> DTO1
    ServiceBE --> DTO2
    ServiceBE --> Entity
    DockerCompose --> DockerfileFE
    DockerCompose --> DockerfileBE
    DockerCompose -.-> EnvExample
    DockerCompose -.-> EnvSecret

    %% Click Events
    click Index "https://github.com/technical-assignment-spherity/vc-wallet/blob/master/frontend/src/index.tsx"
    click App "https://github.com/technical-assignment-spherity/vc-wallet/blob/master/frontend/src/App.tsx"
    click CF "https://github.com/technical-assignment-spherity/vc-wallet/blob/master/frontend/src/components/CredentialForm.tsx"
    click CL "https://github.com/technical-assignment-spherity/vc-wallet/blob/master/frontend/src/components/CredentialList.tsx"
    click CC "https://github.com/technical-assignment-spherity/vc-wallet/blob/master/frontend/src/components/CredentialCard.tsx"
    click CV "https://github.com/technical-assignment-spherity/vc-wallet/blob/master/frontend/src/components/CredentialVerifier.tsx"
    click ServiceFE "https://github.com/technical-assignment-spherity/vc-wallet/blob/master/frontend/src/services/credentialService.ts"
    click Nginx "https://github.com/technical-assignment-spherity/vc-wallet/blob/master/frontend/nginx.conf"
    click DockerfileFE "https://github.com/technical-assignment-spherity/vc-wallet/tree/master/frontend/Dockerfile"
    click main "https://github.com/technical-assignment-spherity/vc-wallet/blob/master/backend/src/main.ts"
    click AppModule "https://github.com/technical-assignment-spherity/vc-wallet/blob/master/backend/src/app.module.ts"
    click Module "https://github.com/technical-assignment-spherity/vc-wallet/blob/master/backend/src/credentials/credentials.module.ts"
    click Controller "https://github.com/technical-assignment-spherity/vc-wallet/blob/master/backend/src/credentials/credentials.controller.ts"
    click ServiceBE "https://github.com/technical-assignment-spherity/vc-wallet/blob/master/backend/src/credentials/credentials.service.ts"
    click DTO1 "https://github.com/technical-assignment-spherity/vc-wallet/blob/master/backend/src/credentials/dto/create-credential.dto.ts"
    click DTO2 "https://github.com/technical-assignment-spherity/vc-wallet/blob/master/backend/src/credentials/dto/verify-credential.dto.ts"
    click Entity "https://github.com/technical-assignment-spherity/vc-wallet/blob/master/backend/src/credentials/entities/credential.entity.ts"
    click DockerfileBE "https://github.com/technical-assignment-spherity/vc-wallet/tree/master/backend/Dockerfile"
    click CliConfig "https://github.com/technical-assignment-spherity/vc-wallet/blob/master/backend/nest-cli.json"
    click TsConfigBE "https://github.com/technical-assignment-spherity/vc-wallet/blob/master/backend/tsconfig.json"
    click DockerCompose "https://github.com/technical-assignment-spherity/vc-wallet/blob/master/docker-compose.yml"
    click EnvExample "https://github.com/technical-assignment-spherity/vc-wallet/blob/master/env.example"

    %% Styles
    classDef frontend fill:#D0E8FF,stroke:#0366D6,color:#0366D6,stroke-width:1px;
    classDef backend fill:#E6FFED,stroke:#28A745,color:#28A745,stroke-width:1px;
    classDef infra fill:#F0F0F0,stroke:#6A737D,color:#6A737D,stroke-width:1px;
    classDef config fill:#FFF5B1,stroke:#DBAB09,color:#735C0F,stroke-width:1px;
    classDef external fill:#FFECEF,stroke:#D73A49,color:#D73A49,stroke-width:1px;
```
