# bluewave-labs/verifywise architecture

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

- Interactive diagram: https://gitdiagram.com/bluewave-labs/verifywise
- Repository: https://github.com/bluewave-labs/verifywise

## Overview

##### High-Level Architecture Components

The system follows a Clean Architecture pattern (as evidenced by the directory structure) with clear separation of concerns. The main components to include are:

a) Frontend Layer (Clients):
- Present as a React-based SPA with the following layers:
- Presentation Layer (/presentation)
- Application Layer (/application)
- Infrastructure Layer (/infrastructure)
- Features like Authentication, Dashboard, Assessment, Compliance Tracking

b) Backend Layer (Servers):
- Node.js-based API server with:
- Controllers Layer (/controllers)
- Models Layer (/models)
- Routes Layer (/routes)
- Database Layer (/database)
- Middleware Layer (/middleware)

##### Component Relationships

- Frontend to Backend communication via REST APIs
- Authentication flow with JWT (shown in auth.middleware.ts)
- Database interactions for various entities (projects, assessments, controls, etc.)
- File management system flow
- User role-based access control (RBAC) flow

##### Key Architectural Elements

Specific components:
**[Frontend (React SPA)] → [API Layer] → [Backend Services] → [Database]**
- ↓
**[Authentication & Authorization]**
- ↓
**[Feature Modules]**
- Projects Management
- Compliance Tracker
- Assessment Tracker
- Vendor Management
- Risk Management
- AI Trust Center
- File Management

##### Data Flow Patterns

Highlight:
- Redux store for state management (shown in /application/redux)
- API request/response flow through customAxios
- File upload/download processes
- Authentication token flow
- Real-time reporting data flow

##### Security Layer

Emphasize:
- End-to-end encryption
- JWT-based authentication
- Role-based access control
- On-premises deployment option

##### Specific Implementation Details

Specialized components:
- Custom hooks (/application/hooks)
- Validation layers (/application/validations)
- Exception handling (/infrastructure/exceptions)
- Middleware implementations

##### Deployment View

Include:
- Docker container architecture
- Database deployment
- API server deployment
- Frontend hosting

Remember to emphasize the platform's key differentiators:
- On-premises hosting capability
- End-to-end encryption
- Open-source nature
- Compliance and assessment tracking
- AI governance-specific features

This will create a comprehensive yet understandable system design that accurately represents the platform's architecture while highlighting its unique value proposition in AI governance.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Frontend
        FE_Pres["Presentation Layer"]
        FE_App["Application Layer"]
        FE_Infra["Infrastructure Layer"]
        
        subgraph Features
            Auth["Authentication"]
            PM["Project Management"]
            CT["Compliance Tracker"]
            AT["Assessment Tracker"]
            VM["Vendor Management"]
            RM["Risk Management"]
            AIT["AI Trust Center"]
            FM["File Management"]
        end
        
        subgraph Core
            Redux["Redux Store"]
            Hooks["Custom Hooks"]
            Valid["Validation Layer"]
            Except["Exception Handling"]
        end
    end
    
    subgraph Backend
        API["API Layer"]
        
        subgraph Services
            Ctrl["Controllers"]
            Models["Models"]
            Routes["Routes"]
            DB["Database"]
            Mid["Middleware"]
        end
        
        subgraph Security
            JWT["JWT Auth"]
            RBAC["Role-Based Access"]
            E2E["End-to-End Encryption"]
        end
    end
    
    %% Frontend Relationships
    FE_Pres --> Features
    FE_App --> Core
    Features --> FE_App
    Core --> FE_Infra
    FE_Infra --> API
    
    %% Backend Relationships
    API --> Ctrl
    Ctrl --> Models
    Routes --> Ctrl
    Models --> DB
    Mid --> Routes
    
    %% Security Flow
    JWT --> Mid
    RBAC --> Mid
    E2E --> API
    
    %% Component Styling
    classDef frontend fill:#3498db,stroke:#2980b9,color:white
    classDef backend fill:#2ecc71,stroke:#27ae60,color:white
    classDef security fill:#f1c40f,stroke:#f39c12,color:black
    classDef core fill:#95a5a6,stroke:#7f8c8d,color:white
    
    class FE_Pres,FE_App,FE_Infra frontend
    class API,Ctrl,Models,Routes,DB,Mid backend
    class JWT,RBAC,E2E security
    class Redux,Hooks,Valid,Except core
    
    %% Click Events
    click FE_Pres "https://github.com/bluewave-labs/verifywise/tree/master/Clients/src/presentation/"
    click FE_App "https://github.com/bluewave-labs/verifywise/tree/master/Clients/src/application/"
    click FE_Infra "https://github.com/bluewave-labs/verifywise/tree/master/Clients/src/infrastructure/"
    click Ctrl "https://github.com/bluewave-labs/verifywise/tree/master/Servers/controllers/"
    click Models "https://github.com/bluewave-labs/verifywise/tree/master/Servers/models/"
    click Routes "https://github.com/bluewave-labs/verifywise/tree/master/Servers/routes/"
    click DB "https://github.com/bluewave-labs/verifywise/tree/master/Servers/database/"
    click Mid "https://github.com/bluewave-labs/verifywise/tree/master/Servers/middleware/"
    click Auth "https://github.com/bluewave-labs/verifywise/tree/master/Clients/src/application/authentication/"
    click Redux "https://github.com/bluewave-labs/verifywise/tree/master/Clients/src/application/redux/"
    click Hooks "https://github.com/bluewave-labs/verifywise/tree/master/Clients/src/application/hooks/"
    click Valid "https://github.com/bluewave-labs/verifywise/tree/master/Clients/src/application/validations/"
    click Except "https://github.com/bluewave-labs/verifywise/tree/master/Clients/src/infrastructure/exceptions/"
    click FM "https://github.com/bluewave-labs/verifywise/tree/master/Clients/src/presentation/components/FileUpload/"
    click PM "https://github.com/bluewave-labs/verifywise/tree/master/Clients/src/presentation/pages/ProjectView/"
    click RM "https://github.com/bluewave-labs/verifywise/tree/master/Clients/src/presentation/components/Risks/"
    click AT "https://github.com/bluewave-labs/verifywise/tree/master/Clients/src/presentation/pages/Assessment/"
    click VM "https://github.com/bluewave-labs/verifywise/tree/master/Clients/src/presentation/pages/Vendors/"
```
