How wizard-aka-aman/splitwise_frontendupdatedui works
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)