# walt-id/waltid-web-wallet architecture

> Architecture diagram of the GitHub repository walt-id/waltid-web-wallet, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/walt-id/waltid-web-wallet
- Repository: https://github.com/walt-id/waltid-web-wallet

## Overview

##### Project Overview & Type
- This project is a white-label, full-stack web wallet tailored for managing verifiable credentials (VCs), decentralized identifiers (DIDs), keys, and NFTs.
- It is built on top of core libraries (SSI-Kit and NFT-Kit) to support SSI and NFT functionality.
- The design supports multiple configurations through Docker Compose and Kubernetes, indicating a production-ready, containerized deployment.

##### Main Components
a. User Interface (Frontend):
- Located in the “web” folder (with Nuxt.js configuration files like nuxt.config.ts).
- Comprises Vue components, layouts, pages, stores, and assets.
- Acts as the presentation layer where users interact with the wallet.

b. Application Backend:
- Main codebase is in the “src/main/kotlin” directory under package “id.walt…”.
- Contains the Application entry point, configurations (e.g., for chain explorer, database, marketplace, wallet), service layers (for credentials, DID handling, NFT services, keys, push notifications, etc.), and controllers in the “web/controllers” package.
- Follows a layered design with controllers for handling HTTP requests, service classes to implement business logic, and repositories for data access.

c. Persistence/Data Layer:
- Database configurations and migration scripts are present in “config” and “src/main/resources/db”.

d. External Services and Libraries:
- External integrations include chain explorers, NFT data fetchers for ecosystems such as Ethereum, Near, Flow, etc.
- The project leverages the SSI-Kit for identity management and NFT-Kit for NFT-related operations.
- Push notifications and credential exchange (via OIDC standards) should be represented as external modules or service interfaces.

e. Deployment/Container Infrastructure:
- Docker files for both frontend and backend (Dockerfiles for backend and frontend).
- Multiple Docker Compose configurations (for issuer, verifier, wallet-backend) that indicate microservice-like deployment of related components.
- Kubernetes deployment YAMLs for various environments under the “k8s” folder.

##### Relationships and Data Flow
- Service layer interactions where business logic (credential handling, DID creation, NFT fetching) is processed.
- Connection from backend services to the Database layer via repository components.
- Configuration and management components, demonstrating how the system loads settings from various config files and environment variables (via Docker Compose and Kubernetes).

##### Architectural Patterns and Design Principles
- The application design follows a layered architecture: UI → API Controllers → Business Services → Repositories/Database.
- The separation of concerns is clear from dedicated directories for components, services, and database models.
- Use of containerized deployment (Docker Compose, Kubernetes) suggests a microservices-style or modular deployment even if it’s packaged as a single application.

##### Final Checklist
- Annotations for technologies:
▸ Frontend: Nuxt.js, Vue, Tailwind CSS.
▸ Backend: Kotlin, Ktor (or similar framework), Repository/Service Pattern.
▸ Databases: PostgreSQL/SQLite (with migration pipelines).
▸ Container orchestration: Docker Compose, Kubernetes.
▸ External Libs: SSI-Kit, NFT-Kit.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Frontend Layer"
        UI["Web UI (Nuxt.js/Vue)"]:::frontend
    end

    subgraph "Backend Layer"
        App["Application Core (Application.kt)"]:::backend
        Controllers["API Controllers (Kotlin)"]:::backend
        Services["Business Services\n(Credentials,DID,NFT,Keys,Push)"]:::backend
        App --> Controllers
        Controllers --> Services
    end

    subgraph "Persistence/Data Layer"
        DBConfigs["DB Configurations"]:::persistence
        Migrations["Migration Scripts"]:::persistence
        Repos["Repositories & Models"]:::persistence
        Database["Database (PostgreSQL/SQLite)"]:::persistence
        Repos -->|"uses"| Database
        DBConfigs -->|"configures"| Database
        Migrations -->|"migrates"| Database
    end

    subgraph "External Services & Libraries"
        ssi["SSI/NFT Services"]:::external
        nft["NFT Components"]:::external
        push["Push Notifications"]:::external
    end

    subgraph "Deployment/Container Infrastructure"
        dockerCompose["Docker Compose"]:::deployment
        backendDocker["backend.Dockerfile"]:::deployment
        frontendDocker["frontend.Dockerfile"]:::deployment
        k8s["Kubernetes"]:::deployment
        frontendDocker -->|"builds"| dockerCompose
        backendDocker -->|"builds"| dockerCompose
        dockerCompose -->|"orchestrates"| k8s
    end

    %% Data Flow Connections
    UI -->|"calls"| Controllers
    Services -->|"calls"| Repos
    Services -->|"integrates"| ssi
    Services -->|"triggers"| nft
    Services -->|"notifies"| push

    %% Deployment Flow Connections
    UI -->|"deployedWith"| frontendDocker
    App -->|"deployedWith"| backendDocker

    %% Click Events
    click UI "https://github.com/walt-id/waltid-web-wallet/blob/main/web/nuxt.config.ts"
    click App "https://github.com/walt-id/waltid-web-wallet/blob/main/src/main/kotlin/id/walt/Application.kt"
    click Controllers "https://github.com/walt-id/waltid-web-wallet/tree/main/src/main/kotlin/id/walt/web/controllers"
    click DBConfigs "https://github.com/walt-id/waltid-web-wallet/tree/main/config"
    click Migrations "https://github.com/walt-id/waltid-web-wallet/tree/main/src/main/resources/db"
    click Repos "https://github.com/walt-id/waltid-web-wallet/tree/main/src/main/kotlin/id/walt/db"
    click ssi "https://github.com/walt-id/waltid-web-wallet/tree/main/src/main/kotlin/id/walt/service"
    click nft "https://github.com/walt-id/waltid-web-wallet/tree/main/src/main/kotlin/id/walt/service/nft"
    click push "https://github.com/walt-id/waltid-web-wallet/tree/main/src/main/kotlin/id/walt/push"
    click dockerCompose "https://github.com/walt-id/waltid-web-wallet/tree/main/docker-compose"
    click backendDocker "https://github.com/walt-id/waltid-web-wallet/blob/main/backend.Dockerfile"
    click frontendDocker "https://github.com/walt-id/waltid-web-wallet/blob/main/frontend.Dockerfile"
    click k8s "https://github.com/walt-id/waltid-web-wallet/tree/main/k8s"

    %% Styles
    classDef frontend fill:#AEDFF7,stroke:#333,stroke-width:2px;
    classDef backend fill:#F7E1AE,stroke:#333,stroke-width:2px;
    classDef persistence fill:#C7F9CC,stroke:#333,stroke-width:2px;
    classDef external fill:#FFCCBC,stroke:#333,stroke-width:2px;
    classDef deployment fill:#D1C4E9,stroke:#333,stroke-width:2px;
```
