# wizard-aka-aman/society_management_frontend architecture

> Architecture diagram of the GitHub repository wizard-aka-aman/society_management_frontend, 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/society_management_frontend
- Repository: https://github.com/wizard-aka-aman/society_management_frontend

## Overview

##### Project Type and Purpose
- Project Type: Single-Page Application (SPA) built with Angular CLI (v19).
- Purpose: A society/ apartment management front-end interface that allows admins and users to register, log in, manage societies, flats, visitors, bookings, bills, complaints, notices, recurring payments, etc.

##### File Structure
Top-level:
├─ src/
├─ app/
├─ Components (one folder per feature: add-society, bills, bookings, cancel, complaints, flats, home, layout, login, manage-users, notices, pagenotfound, recurring, register, register-admin, society-setting, spinner, success, visitors)
├─ app.config.ts (global configuration e.g. API base-URL)
├─ app.routes.ts (route definitions)
├─ auth.guard.ts (route guard for protected routes)
├─ spinner.interceptor.ts (HTTP interceptor for showing spinner)
├─ services/ (service.service.ts: HTTP client wrapper)
├─ styles.css & index.html & main.ts (bootstrap)
Configuration files: angular.json, tsconfig*.json, ngsw-config.json (service worker), package.json.

##### README for Additional Insights
- Generated via Angular CLI—no backend included in repo (expects external API).
- Uses default Angular dev and build commands.
- PWA support (ngsw-config.json + manifest.webmanifest).

##### Main Components & Interactions
a. Presentation Layer (UI Components)
- Login & Registration flows (login.component, register.component, register-admin.component)
- Dashboard layout (layout.component) with child routes: home, add-society, manage-users, society-setting, flats, visitors, bookings, bills, recurring, complaints, notices, cancel, success.
- Shared spinner component (spinner.component) displayed via spinner.interceptor on each HTTP call.
b. Services Layer
- ServiceService (singleton): encapsulates all HTTP calls to external REST API (CRUD for societies, users, flats, etc.)
- AuthGuard: protects routes based on login status.
- SpinnerInterceptor: intercepts HTTP requests to toggle spinner visibility.
c. Configuration & Bootstrap
- AppConfig: holds constants (e.g., API URLs).
- AppRoutes: defines route hierarchy and lazy-load (if applied).
- main.ts & index.html: Angular bootstrapping.
d. External Dependencies
- External REST API (not in repo)
- Browser (running Angular PWA)
- Service Worker (ngsw-config.json) for offline caching
- Third-party libraries from package.json (e.g., Angular Material, if present).

##### Architectural Patterns & Design Principles
- Layered Architecture: Presentation → Services → External API.
- Component-Based Design: each feature as an Angular component.
- Dependency Injection: Angular’s DI for services and interceptors.
- Route-Based Module Organization: feature folders map to routes.
- PWA Pattern: service worker + manifest for offline support.

– Middle layer: Components grouped by domain (Authentication, Dashboard features, Shared spinner)
– Lower layer: Services (ServiceService), Guards, Interceptors, Config.

## Diagram (Mermaid)

```mermaid
flowchart TD
    Browser["Browser / Client"]:::external

    subgraph "Angular SPA"
        Router["Router"]:::router

        subgraph "Authentication Components"
            Login["Login Component"]:::presentation
            Register["Register Component"]:::presentation
            RegAdmin["Register-Admin Component"]:::presentation
        end

        subgraph "Dashboard Components"
            Layout["Layout Component"]:::presentation
            Home["Home Component"]:::presentation
            AddSoc["Add Society Component"]:::presentation
            ManageUsers["Manage Users Component"]:::presentation
            SocietySettings["Society Settings Component"]:::presentation
            Flats["Flats Component"]:::presentation
            Visitors["Visitors Component"]:::presentation
            Bookings["Bookings Component"]:::presentation
            Bills["Bills Component"]:::presentation
            Recurring["Recurring Payments Component"]:::presentation
            Complaints["Complaints Component"]:::presentation
            Notices["Notices Component"]:::presentation
            Cancel["Cancel Component"]:::presentation
            Success["Success Component"]:::presentation
            PageNotFound["Page Not Found Component"]:::presentation
        end

        SpinnerComp["Spinner Component"]:::shared

        subgraph "Services & Config"
            ServiceSvc["ServiceService"]:::service
            AuthGuard["AuthGuard"]:::service
            SpinnerInterceptor["SpinnerInterceptor"]:::service
            AppConfig["AppConfig"]:::config
            AppRoutes["AppRoutes"]:::config
        end

        mainTs["main.ts"]:::bootstrap
        indexHtml["index.html"]:::bootstrap

    end

    subgraph "Public Assets / PWA"
        StaticAssets["Static Assets & Icons"]:::static
        Manifest["Web Manifest"]:::static
        SWConfig["Service Worker Config"]:::static
        ServiceWorker["Service Worker"]:::static
    end

    ExternalAPI["External REST API"]:::external

    %% Connections
    Browser --> Router
    Browser --> ServiceWorker
    ServiceWorker --> Browser

    mainTs --> Router
    indexHtml --> mainTs

    Router --> Login
    Router --> Register
    Router --> RegAdmin
    Router --> Layout
    Router --> PageNotFound

    Layout --> Home
    Layout --> AddSoc
    Layout --> ManageUsers
    Layout --> SocietySettings
    Layout --> Flats
    Layout --> Visitors
    Layout --> Bookings
    Layout --> Bills
    Layout --> Recurring
    Layout --> Complaints
    Layout --> Notices
    Layout --> Cancel
    Layout --> Success

    Login --> ServiceSvc
    Register --> ServiceSvc
    RegAdmin --> ServiceSvc
    Home --> ServiceSvc
    AddSoc --> ServiceSvc
    ManageUsers --> ServiceSvc
    SocietySettings --> ServiceSvc
    Flats --> ServiceSvc
    Visitors --> ServiceSvc
    Bookings --> ServiceSvc
    Bills --> ServiceSvc
    Recurring --> ServiceSvc
    Complaints --> ServiceSvc
    Notices --> ServiceSvc
    Cancel --> ServiceSvc
    Success --> ServiceSvc

    ServiceSvc -.-> SpinnerInterceptor
    SpinnerInterceptor --> ExternalAPI
    ServiceSvc --> ExternalAPI

    AppConfig --> ServiceSvc
    AppRoutes --> Router
    AppRoutes --> AuthGuard
    AuthGuard --> Router

    StaticAssets --> ServiceWorker
    Manifest --> ServiceWorker
    SWConfig --> ServiceWorker

    %% Click Events
    click Login "https://github.com/wizard-aka-aman/society_management_frontend/blob/master/src/app/login/login.component.ts"
    click Register "https://github.com/wizard-aka-aman/society_management_frontend/blob/master/src/app/register/register.component.ts"
    click RegAdmin "https://github.com/wizard-aka-aman/society_management_frontend/blob/master/src/app/register-admin/register-admin.component.ts"
    click Layout "https://github.com/wizard-aka-aman/society_management_frontend/blob/master/src/app/layout/layout.component.ts"
    click Home "https://github.com/wizard-aka-aman/society_management_frontend/blob/master/src/app/home/home.component.ts"
    click AddSoc "https://github.com/wizard-aka-aman/society_management_frontend/blob/master/src/app/add-society/add-society.component.ts"
    click ManageUsers "https://github.com/wizard-aka-aman/society_management_frontend/blob/master/src/app/manage-users/manage-users.component.ts"
    click SocietySettings "https://github.com/wizard-aka-aman/society_management_frontend/blob/master/src/app/society-setting/society-setting.component.ts"
    click Flats "https://github.com/wizard-aka-aman/society_management_frontend/blob/master/src/app/flats/flats.component.ts"
    click Visitors "https://github.com/wizard-aka-aman/society_management_frontend/blob/master/src/app/visitors/visitors.component.ts"
    click Bookings "https://github.com/wizard-aka-aman/society_management_frontend/blob/master/src/app/bookings/bookings.component.ts"
    click Bills "https://github.com/wizard-aka-aman/society_management_frontend/blob/master/src/app/bills/bills.component.ts"
    click Recurring "https://github.com/wizard-aka-aman/society_management_frontend/blob/master/src/app/recurring/recurring.component.ts"
    click Complaints "https://github.com/wizard-aka-aman/society_management_frontend/blob/master/src/app/complaints/complaints.component.ts"
    click Notices "https://github.com/wizard-aka-aman/society_management_frontend/blob/master/src/app/notices/notices.component.ts"
    click Cancel "https://github.com/wizard-aka-aman/society_management_frontend/blob/master/src/app/cancel/cancel.component.ts"
    click Success "https://github.com/wizard-aka-aman/society_management_frontend/blob/master/src/app/success/success.component.ts"
    click PageNotFound "https://github.com/wizard-aka-aman/society_management_frontend/blob/master/src/app/pagenotfound/pagenotfound.component.ts"
    click SpinnerComp "https://github.com/wizard-aka-aman/society_management_frontend/blob/master/src/app/spinner/spinner.component.ts"
    click ServiceSvc "https://github.com/wizard-aka-aman/society_management_frontend/blob/master/src/services/service.service.ts"
    click AuthGuard "https://github.com/wizard-aka-aman/society_management_frontend/blob/master/src/app/auth.guard.ts"
    click SpinnerInterceptor "https://github.com/wizard-aka-aman/society_management_frontend/blob/master/src/app/spinner.interceptor.ts"
    click AppConfig "https://github.com/wizard-aka-aman/society_management_frontend/blob/master/src/app/app.config.ts"
    click AppRoutes "https://github.com/wizard-aka-aman/society_management_frontend/blob/master/src/app/app.routes.ts"
    click mainTs "https://github.com/wizard-aka-aman/society_management_frontend/blob/master/src/main.ts"
    click indexHtml "https://github.com/wizard-aka-aman/society_management_frontend/blob/master/src/index.html"
    click StaticAssets "https://github.com/wizard-aka-aman/society_management_frontend/tree/master/public/icons/"
    click Manifest "https://github.com/wizard-aka-aman/society_management_frontend/blob/master/public/manifest.webmanifest"
    click SWConfig "https://github.com/wizard-aka-aman/society_management_frontend/blob/master/ngsw-config.json"

    %% Styles
    classDef presentation fill:#E3F2FD,stroke:#42A5F5,color:#0D47A1
    classDef service fill:#E8F5E9,stroke:#66BB6A,color:#1B5E20
    classDef shared fill:#FFF3E0,stroke:#FFA726,color:#E65100
    classDef config fill:#F3E5F5,stroke:#AB47BC,color:#4A148C
    classDef bootstrap fill:#ECEFF1,stroke:#78909C,color:#263238
    classDef static fill:#FFFDE7,stroke:#FFEE58,color:#F57F17
    classDef router fill:#E1F5FE,stroke:#29B6F6,color:#01579B
    classDef external fill:#CFD8DC,stroke:#607D8B,color:#263238
```
