# wizard-aka-aman/splitwise_frontendupdatedui architecture

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

- Interactive diagram: https://gitdiagram.com/wizard-aka-aman/splitwise_frontendupdatedui
- Repository: https://github.com/wizard-aka-aman/splitwise_frontendupdatedui

## Overview

##### Project Type & Purpose
- This is a Single-Page Application (SPA) client implemented in Angular (v19).
- Purpose: A Splitwise-style front-end for managing groups, expenses, user chats, and analytics (charts). It interacts with external REST/WebSocket back-ends for data and real-time chat.

##### File Structure & Architectural Insights
- src/app/              → root of the application code
- app.component(.ts/html/css) & app.routes.ts / app.config.ts → root layout, routing definitions, global configuration
- auth.guard.ts       → route guard enforcing authentication
- service/            → HTTP/WebSocket Service(s): chat.service.ts, service.service.ts
- pipe/               → reusable data-transformation (filter.pipe.ts)
- feature folders:
– login/, register/, home/
– addmember/, viewmember/
– creat egroup/, editgroup/
– addexpense/, viewexpense/, activity/
– chat/, personalchat/, peruserchat/
– chart/
– pagenotfound/, layout/
- Configuration & build scripts: angular.json, tsconfig*.json, package.json

##### Main Components
a. Presentation Layer (Components & Modules)
- Feature Modules / Component Groups:
- Auth Module (login, register, auth.guard)
- Management (create/edit/view member)
- Expense Management (add/view expense, activity)
- Chat Module (group chat, personal chat, per-user chat, chat.service)
- Analytics Module (chart.component)
- Layout & Navigation (app.component, layout.component, pagenotfound.component)
- Shared Module: filter.pipe, shared directives/styles
b. Services Layer
- HTTP API Service (service.service.ts) – CRUD calls to backend REST endpoints
- Real-time Service (chat.service.ts) – WebSocket or Socket.io connection
c. Routing Layer
- Angular Router: app.routes.ts defines routes → components → guarded by auth.guard
d. External Systems
- Authentication Server (Token-based auth)
- RESTful Back-end (Groups, Users, Expenses APIs)
- WebSocket Server (Real-time chat)
- Optional Analytics/Charting Library (e.g., Chart.js)

##### Interactions & Data Flow
1. User Action → Angular Router → loads Feature Component
2. Component injects Service → HTTPClient/WebSocket request to external API
3. Backend → JSON response or real-time event → RxJS Observable stream → Component subscription → UI update
4. AuthGuard checks JWT in localStorage before route activation
5. filter.pipe processes data in templates

##### Architectural Patterns & Principles
- Component-Based Architecture (each folder = feature component + tests + styles)
- Dependency Injection (Services as singletons injected into components)
- Reactive Programming (RxJS Observables for HTTP and WebSocket streams)
- Module Separation (feature modules + shared + core)
- MVVM-like: Components (ViewModel) ↔ Templates (View) ↔ Services (Model)

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% User
    User["User"]:::external

    %% Routing
    Router["Angular Router\n(app.routes.ts)"]:::router
    User -->|"navigate"| Router

    %% Layout & Navigation
    subgraph "Layout & Navigation"
        AppComp["AppComponent"]:::ui
        LayoutComp["LayoutComponent"]:::ui
        PNFComp["PageNotFoundComponent"]:::ui
    end
    click AppComp "https://github.com/wizard-aka-aman/splitwise_frontendupdatedui/blob/master/src/app/app.component.ts"
    click LayoutComp "https://github.com/wizard-aka-aman/splitwise_frontendupdatedui/blob/master/src/app/layout/layout.component.ts"
    click PNFComp "https://github.com/wizard-aka-aman/splitwise_frontendupdatedui/blob/master/src/app/pagenotfound/pagenotfound.component.ts"
    Router --> AppComp
    Router --> LayoutComp
    Router --> PNFComp

    %% Auth Module
    subgraph "Auth Module"
        LoginComp["LoginComponent"]:::ui
        RegisterComp["RegisterComponent"]:::ui
        AuthGuard["AuthGuard"]:::service
    end
    click LoginComp "https://github.com/wizard-aka-aman/splitwise_frontendupdatedui/blob/master/src/app/login/login.component.ts"
    click RegisterComp "https://github.com/wizard-aka-aman/splitwise_frontendupdatedui/blob/master/src/app/register/register.component.ts"
    click AuthGuard "https://github.com/wizard-aka-aman/splitwise_frontendupdatedui/blob/master/src/app/auth.guard.ts"
    Router --> LoginComp
    Router --> RegisterComp
    Router --> AuthGuard

    %% Group Management Module
    subgraph "Group Management Module"
        CreateGroup["CreateGroupComponent"]:::ui
        EditGroup["EditGroupComponent"]:::ui
        ViewMembers["ViewMembersComponent"]:::ui
        AddMember["AddMemberComponent"]:::ui
    end
    click CreateGroup "https://github.com/wizard-aka-aman/splitwise_frontendupdatedui/blob/master/src/app/creategroup/creategroup.component.ts"
    click EditGroup "https://github.com/wizard-aka-aman/splitwise_frontendupdatedui/blob/master/src/app/editgroup/editgroup.component.ts"
    click ViewMembers "https://github.com/wizard-aka-aman/splitwise_frontendupdatedui/blob/master/src/app/viewmember/viewmember.component.ts"
    click AddMember "https://github.com/wizard-aka-aman/splitwise_frontendupdatedui/blob/master/src/app/addmember/addmember.component.ts"
    Router --> CreateGroup
    Router --> EditGroup
    Router --> ViewMembers
    Router --> AddMember

    %% Expense Management Module
    subgraph "Expense Management Module"
        AddExpense["AddExpenseComponent"]:::ui
        ViewExpense["ViewExpenseComponent"]:::ui
        ActivityComp["ActivityComponent"]:::ui
    end
    click AddExpense "https://github.com/wizard-aka-aman/splitwise_frontendupdatedui/blob/master/src/app/addexpense/addexpense.component.ts"
    click ViewExpense "https://github.com/wizard-aka-aman/splitwise_frontendupdatedui/blob/master/src/app/viewexpense/viewexpense.component.ts"
    click ActivityComp "https://github.com/wizard-aka-aman/splitwise_frontendupdatedui/blob/master/src/app/activity/activity.component.ts"
    Router --> AddExpense
    Router --> ViewExpense
    Router --> ActivityComp

    %% Chat Module
    subgraph "Chat Module"
        GroupChat["GroupChatComponent"]:::ui
        PersonalChat["PersonalChatComponent"]:::ui
        PerUserChat["PerUserChatComponent"]:::ui
        ChatService["ChatService"]:::service
    end
    click GroupChat "https://github.com/wizard-aka-aman/splitwise_frontendupdatedui/blob/master/src/app/chat/chat.component.ts"
    click PersonalChat "https://github.com/wizard-aka-aman/splitwise_frontendupdatedui/blob/master/src/app/personalchat/personalchat.component.ts"
    click PerUserChat "https://github.com/wizard-aka-aman/splitwise_frontendupdatedui/blob/master/src/app/peruserchat/peruserchat.component.ts"
    click ChatService "https://github.com/wizard-aka-aman/splitwise_frontendupdatedui/blob/master/src/app/chat.service.ts"
    Router --> GroupChat
    Router --> PersonalChat
    Router --> PerUserChat

    %% Analytics Module
    subgraph "Analytics Module"
        ChartComp["ChartComponent"]:::ui
    end
    click ChartComp "https://github.com/wizard-aka-aman/splitwise_frontendupdatedui/blob/master/src/app/chart/chart.component.ts"
    Router --> ChartComp

    %% Shared Module
    subgraph "Shared Module"
        FilterPipe["FilterPipe"]:::pipe
    end
    click FilterPipe "https://github.com/wizard-aka-aman/splitwise_frontendupdatedui/blob/master/src/app/pipe/filter.pipe.ts"
    AuthModuleShared --> FilterPipe

    %% Services Layer
    subgraph "Services Layer"
        HTTPService["HTTP API Service"]:::service
        RealTimeService["Real-time Service"]:::service
    end
    click HTTPService "https://github.com/wizard-aka-aman/splitwise_frontendupdatedui/blob/master/src/app/service/service.service.ts"
    click RealTimeService "https://github.com/wizard-aka-aman/splitwise_frontendupdatedui/blob/master/src/app/chat.service.ts"

    %% Connections: Components to Services
    AuthGuard --> HTTPService
    LoginComp --> HTTPService
    RegisterComp --> HTTPService

    CreateGroup --> HTTPService
    EditGroup --> HTTPService
    ViewMembers --> HTTPService
    AddMember --> HTTPService

    AddExpense --> HTTPService
    ViewExpense --> HTTPService
    ActivityComp --> HTTPService

    ChartComp --> HTTPService

    GroupChat --> RealTimeService
    PersonalChat --> RealTimeService
    PerUserChat --> RealTimeService

    %% External Systems
    subgraph "External Systems"
        AuthServer["Authentication Server"]:::external
        RESTAPI["RESTful Back-end"]:::external
        WebSocketServer["WebSocket Server"]:::external
        ChartJS["Chart.js Library"]:::external
    end

    %% Services to External
    HTTPService -->|"REST Calls"| RESTAPI
    HTTPService -->|"Auth Requests"| AuthServer
    RealTimeService <-->|"WebSocket"| WebSocketServer
    ChartComp -->|"Charting"| ChartJS

    %% Legend
    classDef ui fill:#E0F7FA,stroke:#006064;
    classDef service fill:#E8F5E9,stroke:#1B5E20;
    classDef external fill:#ECEFF1,stroke:#37474F;
    classDef router fill:#FFF3E0,stroke:#E65100;
    classDef pipe fill:#F3E5F5,stroke:#4A148C;
```
