# soo5sin/vest architecture

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

- Interactive diagram: https://gitdiagram.com/soo5sin/vest
- Repository: https://github.com/soo5sin/vest

## Overview

##### Main System Components

a) Frontend (Client)
- React Single Page Application
- Redux Store for state management
- Component Layer
- API Layer

b) Backend (Server)
- Node.js Server
- Data Storage (JSON files)

##### Detailed Component Breakdown

Frontend Architecture:
- Presentation Layer
- Pages (Account, User, Login, etc.)
- Shared Components
- Layout Components

- State Management
- Redux Store
- Reducers (auth, user, account)

- Business Logic
- Custom Hooks
- Utils

- Data Access
- API Instance
- Type Definitions

##### Key Interactions to Highlight

- API calls between frontend and backend
- Data flow through Redux store
- Authentication flow
- Component hierarchy

##### Specific Implementation Details

- Authentication mechanism (JWT tokens)
- Redux store structure
- Component reuse patterns
- API interaction patterns

##### Design Patterns to Highlight

Emphasize:
- Custom hooks pattern for business logic
- Component composition pattern
- Redux state management pattern
- API interceptor pattern

**┌─────────────────────────────────────────┐**
- UI Components              │
- ┤
- Custom Hooks & Logic          │
- ┤
- State Management             │
- ┤
- API Layer                 │
- ┘

##### The API interaction pattern with interceptors

Remember to maintain a balance between detail and clarity, focusing on the architectural decisions that make this application unique, such as the custom hooks pattern and the Redux implementation.

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Client
        direction TB
        AppEntry["App Entry Point"]
        Router["Routing System"]
        
        subgraph "UI Layer"
            direction TB
            Pages["Page Components"]
            Layout["Layout Components"]
            Shared["Shared Components"]
            GlobalStyles["Global Styles"]
            Theme["Theme Config"]
        end
        
        subgraph "Business Logic"
            direction TB
            CustomHooks["Custom Hooks"]
            Utils["Business Logic Utils"]
            AuthLogic["Authentication Logic"]
        end
        
        subgraph "State Management"
            direction TB
            Store["Redux Store"]
            Reducers["Redux Reducers"]
            AuthReducer["Auth Reducer"]
        end
        
        subgraph "Data Layer"
            direction TB
            APIInstance["API Instance"]
            Types["Type Definitions"]
        end
    end
    
    subgraph Server
        direction TB
        BackendServer["Node.js Server"]
        
        subgraph "Data Storage"
            direction TB
            AccountStatus["Account Status"]
            Brokers["Brokers Data"]
            Sider["Sider Data"]
        end
    end
    
    %% Relationships
    AppEntry --> Router
    Router --> Pages
    Pages --> Layout
    Pages --> Shared
    Pages --> GlobalStyles
    GlobalStyles --> Theme
    
    Pages --> CustomHooks
    Pages --> Utils
    CustomHooks --> Store
    Utils --> AuthLogic
    
    Store --> Reducers
    Store --> AuthReducer
    
    CustomHooks --> APIInstance
    APIInstance --> Types
    APIInstance --> BackendServer
    
    BackendServer --> AccountStatus
    BackendServer --> Brokers
    BackendServer --> Sider
    
    %% Styling
    classDef frontend fill:#a8d1ff,stroke:#333,stroke-width:1px
    classDef logic fill:#ffcca8,stroke:#333,stroke-width:1px
    classDef state fill:#a8ffb3,stroke:#333,stroke-width:1px
    classDef data fill:#ffe4a8,stroke:#333,stroke-width:1px
    classDef server fill:#ffb3b3,stroke:#333,stroke-width:1px
    
    class AppEntry,Router,Pages,Layout,Shared,GlobalStyles,Theme frontend
    class CustomHooks,Utils,AuthLogic logic
    class Store,Reducers,AuthReducer state
    class APIInstance,Types data
    class BackendServer,AccountStatus,Brokers,Sider server
    
    %% Click Events
    click AppEntry "https://github.com/soo5sin/vest/blob/main/client/src/App.tsx"
    click Layout "https://github.com/soo5sin/vest/tree/main/client/src/components/layout/"
    click Shared "https://github.com/soo5sin/vest/tree/main/client/src/components/shared/"
    click Store "https://github.com/soo5sin/vest/tree/main/client/src/store/"
    click Reducers "https://github.com/soo5sin/vest/tree/main/client/src/store/reducers/"
    click APIInstance "https://github.com/soo5sin/vest/blob/main/client/src/api/instance.ts"
    click CustomHooks "https://github.com/soo5sin/vest/tree/main/client/src/hooks/"
    click Pages "https://github.com/soo5sin/vest/tree/main/client/src/pages/"
    click AuthLogic "https://github.com/soo5sin/vest/blob/main/client/src/utils/auth.ts"
    click AuthReducer "https://github.com/soo5sin/vest/blob/main/client/src/store/reducers/auth.ts"
    click Types "https://github.com/soo5sin/vest/tree/main/client/src/types/"
    click Router "https://github.com/soo5sin/vest/blob/main/client/src/routes/Router.tsx"
    click BackendServer "https://github.com/soo5sin/vest/blob/main/server/server.ts"
    click AccountStatus "https://github.com/soo5sin/vest/blob/main/server/accountStatus.json"
    click Brokers "https://github.com/soo5sin/vest/blob/main/server/brokers.json"
    click Sider "https://github.com/soo5sin/vest/blob/main/server/sider.json"
    click Utils "https://github.com/soo5sin/vest/tree/main/client/src/utils/"
    click GlobalStyles "https://github.com/soo5sin/vest/blob/main/client/src/styles/Global.ts"
    click Theme "https://github.com/soo5sin/vest/blob/main/client/src/styles/theme.ts"
```
