# sunblob/vanban architecture

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

- Interactive diagram: https://gitdiagram.com/sunblob/vanban
- Repository: https://github.com/sunblob/vanban

## Overview

##### Main Components

A. Frontend Layer (Vue.js Application):
- Present as a single-page application (SPA) structure
- Modules:
- Authentication (sign-in/sign-up)
- Board Management
- Card/List Management
- UI Components System
- State Management (Pinia stores based on the stores/ directory)

B. Backend Layer (Hono Framework):
- API Server structure with modular architecture
- Core modules:
- Auth Service
- Board Service
- Card Service
- Service
- Logs Service
- Middleware layer (especially auth middleware)

C. Database Layer:
- Prisma ORM
- Underlying database (likely PostgreSQL based on Prisma setup)

**[Client Tier]**
- ↓↑
**[Server Tier]**
- ↓↑
**[Data Tier]**

##### Detailed Component Breakdown

Frontend (Top Tier):
- Router (frontend/src/router)
- Store Modules (frontend/src/stores)
- View Components (frontend/src/views)
- Reusable UI Components (frontend/src/components)
- HTTP Client (frontend/src/http)

API Layer (Middle Tier):
- Modules:
- Authentication Module
- Board Module
- Card Module
- Module
- Logs Module
- Middleware layer
- REST API endpoints

Data Layer (Bottom Tier):
- Prisma ORM layer
- Database with main entities:
- Users
- Boards
- Lists
- Cards
- Logs

##### Connection and Flow Indicators

- Green: Authentication flows
- Blue: Data operations
- Orange: Event/WebSocket communications (if implemented)

##### Additional Elements

- Technology versions in small notes
- Security layer indicators (auth middleware, JWT)
- External service integrations if any

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Client
        VueSPA["Vue.js SPA"]
        Router["Router"]:::router
        Store["Store (Pinia)"]:::store
        HTTPClient["HTTP Client"]:::http
        
        subgraph "UI Components"
            AuthForms["Auth Forms"]:::ui
            BoardComp["Board Component"]:::ui
            CardComp["Card Components"]:::ui
            UISystem["UI System"]:::ui
        end
        
        subgraph "Views"
            BoardViews["Board Views"]:::view
        end
    end
    
    subgraph Server
        HonoServer["Hono Server"]
        
        subgraph "API Modules"
            AuthService["Auth Service"]:::service
            BoardService["Board Service"]:::service
            CardService["Card Service"]:::service
            ListService["List Service"]:::service
            LogsService["Logs Service"]:::service
        end
        
        AuthMiddleware["Auth Middleware"]:::middleware
    end
    
    subgraph Database
        PrismaORM["Prisma ORM"]:::orm
        DB[(PostgreSQL)]:::db
        
        subgraph "Entities"
            Users[("Users")]:::entity
            Boards[("Boards")]:::entity
            Lists[("Lists")]:::entity
            Cards[("Cards")]:::entity
            Logs[("Logs")]:::entity
        end
    end
    
    %% Frontend Connections
    VueSPA --> Router
    VueSPA --> Store
    VueSPA --> HTTPClient
    Router --> BoardViews
    Store --> HTTPClient
    
    %% Backend Connections
    HTTPClient --> AuthMiddleware
    AuthMiddleware --> HonoServer
    HonoServer --> AuthService
    HonoServer --> BoardService
    HonoServer --> CardService
    HonoServer --> ListService
    HonoServer --> LogsService
    
    %% Database Connections
    AuthService --> PrismaORM
    BoardService --> PrismaORM
    CardService --> PrismaORM
    ListService --> PrismaORM
    LogsService --> PrismaORM
    PrismaORM --> DB
    DB --> Users
    DB --> Boards
    DB --> Lists
    DB --> Cards
    DB --> Logs
    
    %% Click Events
    click AuthForms "https://github.com/sunblob/vanban/blob/main/frontend/src/components/forms/sign-in-form.vue"
    click BoardComp "https://github.com/sunblob/vanban/blob/main/frontend/src/components/vanban-board.vue"
    click Store "https://github.com/sunblob/vanban/tree/main/frontend/src/stores/"
    click Router "https://github.com/sunblob/vanban/blob/main/frontend/src/router/index.ts"
    click UISystem "https://github.com/sunblob/vanban/tree/main/frontend/src/components/ui/"
    click AuthService "https://github.com/sunblob/vanban/tree/main/backend/src/modules/auth/"
    click BoardService "https://github.com/sunblob/vanban/tree/main/backend/src/modules/board/"
    click CardService "https://github.com/sunblob/vanban/tree/main/backend/src/modules/card/"
    click ListService "https://github.com/sunblob/vanban/tree/main/backend/src/modules/list/"
    click LogsService "https://github.com/sunblob/vanban/tree/main/backend/src/modules/logs/"
    click AuthMiddleware "https://github.com/sunblob/vanban/blob/main/backend/src/middlewares/auth.ts"
    click PrismaORM "https://github.com/sunblob/vanban/blob/main/backend/prisma/schema.prisma"
    click HTTPClient "https://github.com/sunblob/vanban/blob/main/frontend/src/http/net-client.ts"
    click BoardViews "https://github.com/sunblob/vanban/blob/main/frontend/src/views/board-details-page.vue"
    click CardComp "https://github.com/sunblob/vanban/blob/main/frontend/src/components/vanban-board-card.vue"
    
    %% Styling
    classDef default fill:#f9f9f9,stroke:#333,stroke-width:2px
    classDef service fill:#afd7ff,stroke:#333
    classDef middleware fill:#ffb86c,stroke:#333
    classDef ui fill:#98c379,stroke:#333
    classDef view fill:#61afef,stroke:#333
    classDef db fill:#ff79c6,stroke:#333
    classDef orm fill:#bd93f9,stroke:#333
    classDef entity fill:#f1fa8c,stroke:#333
    classDef router fill:#50fa7b,stroke:#333
    classDef store fill:#ff5555,stroke:#333
    classDef http fill:#8be9fd,stroke:#333
```
