# pradhuman0508/splitwise-frontend architecture

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

- Interactive diagram: https://gitdiagram.com/pradhuman0508/splitwise-frontend
- Repository: https://github.com/pradhuman0508/splitwise-frontend

## Overview

##### Project type and purpose
- This is a Single-Page Application (SPA) built with Angular (v18.2.12) that uses Angular Universal for server-side rendering (SSR).
- It’s named “SplitwiseFrontend” and implements the UI, routing, and business logic for an expense-splitting tool.
- Firebase is used for authentication and data storage.

##### File structure
- Top-level artifacts:
- angular.json, tsconfig*.json – Angular CLI configuration
- package.json – dependencies and scripts
- server.ts – Node/Express entry point for SSR
- public/ – static assets served by the server
- src/ folder:
- main.ts – client bootstrap of Angular app
- main.server.ts + app.module.server.ts – server-side bootstrap modules
- app/ – core Angular code
– app.module.ts – root NgModule for browser
– app-routing.module.ts – route definitions (landing, login, register, dashboard)
– guards/ – route guards (auth.guard.ts)
– pages/ – feature modules with components per page
– services/ – injectable services (auth.service.ts, firebase.service.ts)
- environments/ – environment-specific configuration
- assets/ – SCSS theming, layout, demo code, images, flags
- styles.*, tailwind.config.js – global styling via SCSS and Tailwind CSS

##### README for additional insights
- Confirms reliance on `ng serve`, `ng build`, Karma tests, etc.
- Implies developer-centric setup; no custom microservices beyond Firebase.

a. Main components to represent:
- Client Browser (requests pages, executes client bundle)
- Node/Express SSR Server (server.ts)
- Angular Application
– Browser Module (main.ts → app.module.ts)
– Server Module (main.server.ts → app.module.server.ts)
- Firebase (Auth, Firestore/Realtime Database)
- Static Asset Store / CDN (public/, assets/)
b. Relationships and interactions:
- Browser → HTTP GET → SSR Server → Angular Universal renders HTML → Browser
- Browser → serves client bundle (JavaScript, CSS) → executes Angular client
- Angular services (auth.service, firebase.service) ↔ Firebase SDK
- Guards/router coordinate navigation within client
- Build pipeline (Angular CLI) generates server & browser bundles
c. Architectural patterns and design principles:
- Component-based UI (Angular Components under pages/)
- Module separation (AppModule vs AppModuleServer) for SSR
- Dependency Injection for services and guards
- Route Guards handle protected routes (AuthGuard)
- Style theming via SCSS and Tailwind
d. Key technologies/frameworks:
- Angular (CLI, Universal)
- Node.js + Express (in server.ts)
- Firebase (Auth, Firestore)
- TypeScript, SCSS, Tailwind CSS

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Top-level components
    Browser["Client Browser"]:::frontend
    SSR["SSR Server<br/>(Express)<br/>server.ts"]:::backend
    Static["Static Assets / CDN"]:::static
    FirebaseAuth["Firebase Auth"]:::external
    FirebaseDB["Firebase Firestore/RTDB"]:::external

    %% Angular application
    subgraph "Angular Application"
        AngularServer["Angular Server Module<br/>main.server.ts"]:::backend
        AngularBrowser["Angular Browser Module<br/>main.ts"]:::frontend
        Routing["App Routing Module<br/>app-routing.module.ts"]:::frontend
        AuthGuard["Auth Guard<br/>auth.guard.ts"]:::frontend
        AuthService["Auth Service<br/>auth.service.ts"]:::frontend
        FirebaseService["Firebase Data Service<br/>firebase.service.ts"]:::frontend
        Env["Environment Config<br/>environment.ts"]:::frontend
        subgraph "Pages"
            LandingComp["Landing Page<br/>landing.component.ts"]:::frontend
            LoginComp["Login Page<br/>login.component.ts"]:::frontend
            RegisterComp["Register Page<br/>register.component.ts"]:::frontend
            DashboardComp["Dashboard Page<br/>dashboard.component.ts"]:::frontend
        end
    end

    %% Build and styles
    Build["Angular CLI & Build<br/>angular.json"]:::backend
    Styles["Global Styles & Theming<br/>styles.scss"]:::static

    %% Relationships
    Browser -->|"GET / (SSR)"| SSR
    SSR -->|"Bootstrap server bundle"| AngularServer
    AngularServer -->|"Render HTML"| Browser
    Browser -->|"Load JS/CSS bundle"| Static
    Browser -->|"Execute client app"| AngularBrowser
    AngularBrowser -->|"Uses routing"| Routing
    Routing -->|"Guards routes"| AuthGuard
    Routing -->|"Route to Landing"| LandingComp
    Routing -->|"Route to Login"| LoginComp
    Routing -->|"Route to Register"| RegisterComp
    Routing -->|"Route to Dashboard"| DashboardComp
    AngularBrowser -->|"Injects"| AuthService
    AngularBrowser -->|"Injects"| FirebaseService
    AngularServer -->|"Uses via SSR"| FirebaseService
    AuthService -->|"Auth API"| FirebaseAuth
    FirebaseService -->|"DB API"| FirebaseDB
    Build -->|"Generates bundles"| AngularServer
    Build -->|"Generates bundles"| AngularBrowser
    Build -->|"Reads config"| Env
    Static -->|"Served by Express"| SSR
    Static -->|"CSS/Images"| AngularBrowser
    Styles -->|"Built into CSS"| Static

    %% Click Events
    click Browser "https://github.com/pradhuman0508/splitwise-frontend/blob/main/src/index.html"
    click SSR "https://github.com/pradhuman0508/splitwise-frontend/blob/main/server.ts"
    click AngularBrowser "https://github.com/pradhuman0508/splitwise-frontend/blob/main/src/main.ts"
    click AngularServer "https://github.com/pradhuman0508/splitwise-frontend/blob/main/src/main.server.ts"
    click Routing "https://github.com/pradhuman0508/splitwise-frontend/blob/main/src/app/app-routing.module.ts"
    click AuthGuard "https://github.com/pradhuman0508/splitwise-frontend/blob/main/src/app/guards/auth.guard.ts"
    click LandingComp "https://github.com/pradhuman0508/splitwise-frontend/blob/main/src/app/pages/landing/landing.component.ts"
    click LoginComp "https://github.com/pradhuman0508/splitwise-frontend/blob/main/src/app/pages/login/login.component.ts"
    click RegisterComp "https://github.com/pradhuman0508/splitwise-frontend/blob/main/src/app/pages/register/register.component.ts"
    click DashboardComp "https://github.com/pradhuman0508/splitwise-frontend/blob/main/src/app/pages/dashboard/dashboard.component.ts"
    click AuthService "https://github.com/pradhuman0508/splitwise-frontend/blob/main/src/app/services/auth.service.ts"
    click FirebaseService "https://github.com/pradhuman0508/splitwise-frontend/blob/main/src/app/services/firebase.service.ts"
    click Env "https://github.com/pradhuman0508/splitwise-frontend/blob/main/src/environments/environment.ts"
    click Static "https://github.com/pradhuman0508/splitwise-frontend/tree/main/public/"
    click Styles "https://github.com/pradhuman0508/splitwise-frontend/blob/main/src/styles.scss"
    click Build "https://github.com/pradhuman0508/splitwise-frontend/blob/main/angular.json"

    %% Styles
    classDef frontend fill:#D0E8FF,stroke:#0366D6,color:#034A91,stroke-width:1px;
    classDef backend fill:#E2F8E2,stroke:#28A745,color:#19692C,stroke-width:1px;
    classDef external fill:#FFF4E5,stroke:#FF8C00,color:#A14A00,stroke-width:1px,stroke-dasharray: 5 5;
    classDef static fill:#F0F0F0,stroke:#6C757D,color:#343A40,stroke-width:1px,stroke-dasharray: 2 2;
```
