# sara-72/ma5azen-03ad architecture

> Architecture diagram of the GitHub repository sara-72/ma5azen-03ad, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-04-05). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/sara-72/ma5azen-03ad
- Repository: https://github.com/sara-72/ma5azen-03ad

## Overview

1. This is an Angular 19 single-page application. The root entry points are `src/main.ts`, `app.config.ts`, and `app.routes.ts`, which indicates a routing-first, component-based architecture rather than a server-rendered app.

2. The UI is organized around a small shared shell and many page-level views. Shared layout pieces live in `src/app/components`:
   - `header`
   - `footer`
   - `global-loader`
   These are likely composed around routed page content in `app.component`.

3. The application has a broad role- or workflow-based page structure under `src/app/pages`. The route set suggests multiple user personas or operational areas, including:
   - authentication pages: `login*`, `forgot-pass`, `otp-pass`, `reset-pass`
   - general pages: `home`, `about`, `features`
   - operational dashboards: `admin`, `admin2`, `employee*`, `employee_ma5azen*`, `modeer*`, `o3ad*`, `ameen*`, `elda3m`
   This implies the primary architectural boundary is route-driven access to separate functional areas.

4. Authentication is a distinct subsystem. The presence of `auth.service.ts` and `auth.guard.ts` shows that login state and route protection are centralized in services rather than handled inside individual pages. The password recovery flow is split across multiple dedicated screens, suggesting a multi-step auth journey.

5. Loading state is also centralized. `loading.service.ts` and `global-loader.component` suggest a cross-cutting UI layer that can show a spinner/overlay during async work, likely triggered by services rather than individual components managing their own loaders.

6. Business logic is separated into domain services under `src/app/services`. The service names indicate discrete responsibility areas:
   - `central-store.service.ts` for shared client-side state
   - `ledger.service.ts`
   - `employee-stock.service.ts`
   - `store-keeper-stock.service.ts`
   - `custody-records.service.ts`
   - `CustodyAuditsService.ts`
   - `spend-note.service.ts` / `spend-notes.service.ts`
   - `spend-permission.service.ts`
   - `additions.service.ts`
   - `modeer.service.ts`
   These services are the main boundary between the UI and domain/data operations.

7. Data flow is likely routed through pages into services and back into shared state. Page components appear thin and route-scoped, while services handle fetching, mutation, and coordination. The `central-store` and loader/auth services suggest shared state and cross-page behavior are intentionally lifted out of the views.

8. The project likely talks to a backend API through Angular’s HTTP layer, with `src/proxy.conf.json` indicating local development API proxying. That makes the Angular app the frontend boundary and the backend an external dependency hidden behind proxied requests.

9. Asset and presentation concerns are kept separate from behavior. Static media is under `src/assets/images`, while styling is split per component/page with global styles in `src/styles.css`. This is a conventional Angular separation of layout, page views, and shared assets.

10. Testing is present but lightweight and component/service oriented. The tree includes `.spec.ts` files for most pages/components and several services, implying unit tests are colocated with the implementation and likely focus on isolated component/service behavior rather than end-to-end orchestration.

11. From an architecture-diagram perspective, the clearest top-level blocks are:
   - Angular shell and router
   - shared layout components
   - auth and loading cross-cutting services
   - domain services for business workflows
   - route-specific pages for each user role/work area
   - backend API behind the proxy
   This is primarily a frontend modular monolith with strong route-level segmentation.

Main entry points: [`src/app/app.routes.ts`](https://github.com/sara-72/ma5azen-03ad/blob/main/src/app/app.routes.ts) (app.routes), [`src/app/pages/employee/employee1/employee1.component.ts`](https://github.com/sara-72/ma5azen-03ad/blob/main/src/app/pages/employee/employee1/employee1.component.ts) (Role workspaces), [`src/proxy.conf.json`](https://github.com/sara-72/ma5azen-03ad/blob/main/src/proxy.conf.json) (API proxy), [`src/app/app.component.ts`](https://github.com/sara-72/ma5azen-03ad/blob/main/src/app/app.component.ts) (App shell)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_bootstrap["Bootstrap"]
  node_main["main.ts<br/>entrypoint<br/>[main.ts]"]
  node_config["app.config<br/>app config<br/>[app.config.ts]"]
  node_routes["app.routes<br/>route map<br/>[app.routes.ts]"]
end

subgraph group_shell["Shell"]
  node_app["App shell<br/>root component<br/>[app.component.ts]"]
  node_header["Header<br/>layout component"]
  node_footer["Footer<br/>layout component"]
  node_loader(("Loader<br/>ui overlay"))
end

subgraph group_pages["Pages"]
  node_authpages["Auth pages<br/>page group"]
  node_publicpages["Public pages<br/>page group<br/>[home.component.ts]"]
  node_admindash["Admin views<br/>page group<br/>[admin.component.ts]"]
  node_rolepages["Role workspaces<br/>page group"]
end

subgraph group_services["Services"]
  node_authsvc["Auth service<br/>session service<br/>[auth.service.ts]"]
  node_authguard{{"Auth guard<br/>route guard<br/>[auth.guard.ts]"}}
  node_loadingsvc["Loading service<br/>ui state service<br/>[loading.service.ts]"]
  node_store["Central store<br/>shared state"]
  node_ledger["Ledger<br/>domain service<br/>[ledger.service.ts]"]
  node_stock["Stock services<br/>domain service"]
  node_custody["Custody<br/>domain service"]
  node_spend["Spend flows<br/>domain service"]
  node_modeer["Modeer service<br/>domain service<br/>[modeer.service.ts]"]
end

subgraph group_infra["Infrastructure"]
  node_proxy["API proxy<br/>dev proxy<br/>[proxy.conf.json]"]
end

node_main -->|"boots"| node_config
node_main -->|"loads"| node_routes
node_config -->|"registers"| node_authguard
node_config -->|"provides"| node_loadingsvc
node_routes -->|"hosts"| node_app
node_routes -->|"maps"| node_authpages
node_routes -->|"maps"| node_publicpages
node_routes -->|"maps"| node_admindash
node_routes -->|"maps"| node_rolepages
node_app -->|"contains"| node_header
node_app -->|"contains"| node_footer
node_app -->|"contains"| node_loader
node_authguard -->|"checks"| node_authsvc
node_loader -->|"subscribes"| node_loadingsvc
node_authpages -->|"calls"| node_authsvc
node_rolepages -->|"uses"| node_ledger
node_rolepages -->|"uses"| node_stock
node_rolepages -->|"uses"| node_custody
node_rolepages -->|"uses"| node_spend
node_rolepages -->|"uses"| node_modeer
node_publicpages -->|"shares"| node_store
node_admindash -->|"shares"| node_store
node_ledger -->|"requests"| node_proxy
node_stock -->|"requests"| node_proxy
node_custody -->|"requests"| node_proxy
node_spend -->|"requests"| node_proxy
node_modeer -->|"requests"| node_proxy

click node_main "https://github.com/sara-72/ma5azen-03ad/blob/main/src/main.ts"
click node_config "https://github.com/sara-72/ma5azen-03ad/blob/main/src/app/app.config.ts"
click node_routes "https://github.com/sara-72/ma5azen-03ad/blob/main/src/app/app.routes.ts"
click node_app "https://github.com/sara-72/ma5azen-03ad/blob/main/src/app/app.component.ts"
click node_header "https://github.com/sara-72/ma5azen-03ad/blob/main/src/app/components/header/header.component.ts"
click node_footer "https://github.com/sara-72/ma5azen-03ad/blob/main/src/app/components/footer/footer.component.ts"
click node_loader "https://github.com/sara-72/ma5azen-03ad/blob/main/src/app/components/global-loader/global-loader.component.ts"
click node_authsvc "https://github.com/sara-72/ma5azen-03ad/blob/main/src/app/services/auth.service.ts"
click node_authguard "https://github.com/sara-72/ma5azen-03ad/blob/main/src/app/services/auth.guard.ts"
click node_loadingsvc "https://github.com/sara-72/ma5azen-03ad/blob/main/src/app/services/loading.service.ts"
click node_store "https://github.com/sara-72/ma5azen-03ad/blob/main/src/app/services/central-store.service.ts"
click node_ledger "https://github.com/sara-72/ma5azen-03ad/blob/main/src/app/services/ledger.service.ts"
click node_stock "https://github.com/sara-72/ma5azen-03ad/blob/main/src/app/services/employee-stock.service.ts"
click node_custody "https://github.com/sara-72/ma5azen-03ad/blob/main/src/app/services/custody-records.service.ts"
click node_spend "https://github.com/sara-72/ma5azen-03ad/blob/main/src/app/services/spend-note.service.ts"
click node_modeer "https://github.com/sara-72/ma5azen-03ad/blob/main/src/app/services/modeer.service.ts"
click node_authpages "https://github.com/sara-72/ma5azen-03ad/blob/main/src/app/pages/login-page/login-page.component.ts"
click node_publicpages "https://github.com/sara-72/ma5azen-03ad/blob/main/src/app/pages/home/home.component.ts"
click node_admindash "https://github.com/sara-72/ma5azen-03ad/blob/main/src/app/pages/admin/admin.component.ts"
click node_rolepages "https://github.com/sara-72/ma5azen-03ad/blob/main/src/app/pages/employee/employee1/employee1.component.ts"
click node_proxy "https://github.com/sara-72/ma5azen-03ad/blob/main/src/proxy.conf.json"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_main,node_config,node_routes toneBlue
class node_app,node_header,node_footer,node_loader toneAmber
class node_authpages,node_publicpages,node_admindash,node_rolepages toneMint
class node_authsvc,node_authguard,node_loadingsvc,node_store,node_ledger,node_stock,node_custody,node_spend,node_modeer toneRose
class node_proxy toneIndigo
```

## Components

### Bootstrap

Angular entry and route wiring

- [main.ts](https://github.com/sara-72/ma5azen-03ad/blob/main/src/main.ts): entrypoint · App bootstrap · `src/main.ts`
- [app.config](https://github.com/sara-72/ma5azen-03ad/blob/main/src/app/app.config.ts): app config · Providers and app setup · `src/app/app.config.ts`
- [app.routes](https://github.com/sara-72/ma5azen-03ad/blob/main/src/app/app.routes.ts): route map · Route definitions · `src/app/app.routes.ts`

### Shell

Shared layout and cross-cutting UI

- [App shell](https://github.com/sara-72/ma5azen-03ad/blob/main/src/app/app.component.ts): root component · Top-level SPA container · `src/app/app.component.ts`
- [Header](https://github.com/sara-72/ma5azen-03ad/blob/main/src/app/components/header/header.component.ts): layout component · Global header · `src/app/components/header/header.component.ts`
- [Footer](https://github.com/sara-72/ma5azen-03ad/blob/main/src/app/components/footer/footer.component.ts): layout component · Global footer · `src/app/components/footer/footer.component.ts`
- [Loader](https://github.com/sara-72/ma5azen-03ad/blob/main/src/app/components/global-loader/global-loader.component.ts): ui overlay · Global loading indicator · `src/app/components/global-loader/global-loader.component.ts`

### Pages

Route-level views grouped by function

- [Auth pages](https://github.com/sara-72/ma5azen-03ad/blob/main/src/app/pages/login-page/login-page.component.ts): page group · Login and recovery screens · `src/app/pages/login-page/login-page.component.ts`
- [Public pages](https://github.com/sara-72/ma5azen-03ad/blob/main/src/app/pages/home/home.component.ts): page group · Home, about, and features · `src/app/pages/home/home.component.ts`
- [Admin views](https://github.com/sara-72/ma5azen-03ad/blob/main/src/app/pages/admin/admin.component.ts): page group · Admin dashboard screens · `src/app/pages/admin/admin.component.ts`
- [Role workspaces](https://github.com/sara-72/ma5azen-03ad/blob/main/src/app/pages/employee/employee1/employee1.component.ts): page group · Employee, store, manager, custody, and support areas · `src/app/pages/employee/employee1/employee1.component.ts`

### Services

Auth, state, and domain logic

- [Auth service](https://github.com/sara-72/ma5azen-03ad/blob/main/src/app/services/auth.service.ts): session service · Login state and session handling · `src/app/services/auth.service.ts`
- [Auth guard](https://github.com/sara-72/ma5azen-03ad/blob/main/src/app/services/auth.guard.ts): route guard · Protects authenticated routes · `src/app/services/auth.guard.ts`
- [Loading service](https://github.com/sara-72/ma5azen-03ad/blob/main/src/app/services/loading.service.ts): ui state service · Shared loading state · `src/app/services/loading.service.ts`
- [Central store](https://github.com/sara-72/ma5azen-03ad/blob/main/src/app/services/central-store.service.ts): shared state · Cross-page client state · `src/app/services/central-store.service.ts`
- [Ledger](https://github.com/sara-72/ma5azen-03ad/blob/main/src/app/services/ledger.service.ts): domain service · Ledger operations · `src/app/services/ledger.service.ts`
- [Stock services](https://github.com/sara-72/ma5azen-03ad/blob/main/src/app/services/employee-stock.service.ts): domain service · Employee and store stock workflows · `src/app/services/employee-stock.service.ts`
- [Custody](https://github.com/sara-72/ma5azen-03ad/blob/main/src/app/services/custody-records.service.ts): domain service · Custody records and audits · `src/app/services/custody-records.service.ts`
- [Spend flows](https://github.com/sara-72/ma5azen-03ad/blob/main/src/app/services/spend-note.service.ts): domain service · Spend notes, permissions, and additions · `src/app/services/spend-note.service.ts`
- [Modeer service](https://github.com/sara-72/ma5azen-03ad/blob/main/src/app/services/modeer.service.ts): domain service · Manager workflow operations · `src/app/services/modeer.service.ts`

### Infrastructure

Build-time and backend boundary

- [API proxy](https://github.com/sara-72/ma5azen-03ad/blob/main/src/proxy.conf.json): dev proxy · Frontend-to-backend request proxy · `src/proxy.conf.json`

## Connections

- main.ts → app.config: boots · Bootstrap uses app providers
- main.ts → app.routes: loads · App starts from routed navigation
- app.config → Auth guard: registers · Route protection available to the app
- app.config → Loading service: provides · Shared services configured at app level
- app.routes → App shell: hosts · Root shell contains routed content
- app.routes → Auth pages: maps · Authentication journey routes
- app.routes → Public pages: maps · Public landing routes
- app.routes → Admin views: maps · Admin routes
- app.routes → Role workspaces: maps · Role-specific operational routes
- App shell → Header: contains · Shared top-level layout
- App shell → Footer: contains · Shared bottom-level layout
- App shell → Loader: contains · Global loading UI overlay
- Auth guard → Auth service: checks · Guard depends on auth state
- Loader → Loading service: subscribes · Loader reflects shared loading state
- Auth pages → Auth service: calls · Login and recovery screens use auth flows
- Role workspaces → Ledger: uses · Operational screens depend on domain services
- Role workspaces → Stock services: uses · Stock workflows back role screens
- Role workspaces → Custody: uses · Custody views depend on custody services
- Role workspaces → Spend flows: uses · Spend and permission flows
- Role workspaces → Modeer service: uses · Manager workflows use dedicated service
- Public pages → Central store: shares · Pages can read/write shared client state
- Admin views → Central store: shares · Admin views coordinate through central state
- Ledger → API proxy: requests · Domain services reach backend through proxied HTTP
- Stock services → API proxy: requests · Backend API access through proxy
- Custody → API proxy: requests · Backend API access through proxy
- Spend flows → API proxy: requests · Backend API access through proxy
- Modeer service → API proxy: requests · Backend API access through proxy
