# rashidaltayeb/queue-system architecture

> Architecture diagram of the GitHub repository rashidaltayeb/queue-system, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-26). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/rashidaltayeb/queue-system
- Repository: https://github.com/rashidaltayeb/queue-system

## Overview

##### Project Type and Purpose
- This is a single‐page web application (SPA) built with Angular (CLI v13) that manages a patient queue for doctor visits.
- It uses Angular Material and Flex-Layout for UI, and json-server as a fake REST API layer backed by `db.json`.

##### Main Components
a. Frontend (Browser / Angular App)
- Angular Modules
- AppModule (root)
- MaterialComponentModule (imports Angular Material components)
- Angular Router
- Routes defined in `app-routing.module.ts` for Home, Patient, Ticket, Waiting
- UI Components
- HomeComponent
- PatientComponent (with NewPatientComponent and ViewPatientComponent)
- TicketComponent
- WaitingComponent
- SideNavComponent
- Services
- PatientService (handles CRUD via HTTP)
- Assets & Configuration
- `src/assets/` (CSS, images, screenshots)
- Environment files (`environment.ts`, `environment.prod.ts`)
- Angular CLI config (`angular.json`, `tsconfig.json`)

b. Backend (Fake API)
- json-server
- Serves REST endpoints (e.g. GET/POST/PUT `/patients`)
- Data store: `db.json`

##### Relationships & Data Flow
1. User interacts with Angular UI in the browser.
2. Components invoke PatientService.
3. PatientService issues HTTP requests (GET/POST/PUT/DELETE) to json-server endpoints configured in `environment.ts`.
4. json-server reads/writes to `db.json` and returns JSON payloads.
5. Service returns observables to components, which update the view.

##### Architectural Patterns / Principles
- Client‐Server (clean separation of UI and API)
- SPA with Router controlling views
- Service layer abstracts HTTP and data operations
- Modular design (feature components, material module)
- Configurable environments for API URL

## Diagram (Mermaid)

```mermaid
flowchart TD
    Browser["Browser"]:::external
    subgraph "Angular SPA"
        direction TB
        AppModule["AppModule"]:::frontend
        MaterialModule["MaterialComponentModule"]:::frontend
        RoutingModule["AppRoutingModule"]:::frontend
        subgraph "UI Components"
            direction TB
            HomeComp["HomeComponent"]:::frontend
            PatientComp["PatientComponent"]:::frontend
            NewPatientComp["NewPatientComponent"]:::frontend
            ViewPatientComp["ViewPatientComponent"]:::frontend
            TicketComp["TicketComponent"]:::frontend
            WaitingComp["WaitingComponent"]:::frontend
            SideNavComp["SideNavComponent"]:::frontend
        end
    end

    PatientService["PatientService"]:::service
    API["json-server API"]:::api
    DB["db.json"]:::data
    Env["environment.ts / environment.prod.ts"]:::config

    Browser -->|"loads SPA"| AppModule
    AppModule --> MaterialModule
    AppModule --> RoutingModule
    AppModule --> HomeComp
    AppModule --> PatientComp
    AppModule --> TicketComp
    AppModule --> WaitingComp
    AppModule --> SideNavComp
    PatientComp --> NewPatientComp
    PatientComp --> ViewPatientComp

    HomeComp -->|"calls"| PatientService
    PatientComp -->|"calls"| PatientService
    NewPatientComp -->|"calls"| PatientService
    ViewPatientComp -->|"calls"| PatientService
    TicketComp -->|"calls"| PatientService
    WaitingComp -->|"calls"| PatientService

    PatientService --> Env
    PatientService -->|"HTTP GET/POST/PUT /patients"| API
    API -->|"reads/writes"| DB
    API -->|"returns JSON"| PatientService
    PatientService -->|"observables"| HomeComp

    subgraph Legend
        direction TB
        F[Frontend Module/Component]:::frontend
        S[Service Layer]:::service
        A[API Server]:::api
        D[Data Store]:::data
        C[Config Files]:::config
        E[External Entity]:::external
    end

    %% Click Events
    click AppModule "https://github.com/rashidaltayeb/queue-system/blob/main/src/app/app.module.ts"
    click MaterialModule "https://github.com/rashidaltayeb/queue-system/blob/main/src/app/material-component/material-component.module.ts"
    click RoutingModule "https://github.com/rashidaltayeb/queue-system/blob/main/src/app/app-routing.module.ts"
    click HomeComp "https://github.com/rashidaltayeb/queue-system/blob/main/src/app/component/home/home.component.ts"
    click HomeComp "https://github.com/rashidaltayeb/queue-system/blob/main/src/app/component/home/home.component.html"
    click PatientComp "https://github.com/rashidaltayeb/queue-system/blob/main/src/app/component/patient/patient.component.ts"
    click PatientComp "https://github.com/rashidaltayeb/queue-system/blob/main/src/app/component/patient/patient.component.html"
    click NewPatientComp "https://github.com/rashidaltayeb/queue-system/blob/main/src/app/component/patient/new-patient/new-patient.component.ts"
    click NewPatientComp "https://github.com/rashidaltayeb/queue-system/blob/main/src/app/component/patient/new-patient/new-patient.component.html"
    click ViewPatientComp "https://github.com/rashidaltayeb/queue-system/blob/main/src/app/component/patient/view-patient/view-patient.component.ts"
    click ViewPatientComp "https://github.com/rashidaltayeb/queue-system/blob/main/src/app/component/patient/view-patient/view-patient.component.html"
    click TicketComp "https://github.com/rashidaltayeb/queue-system/blob/main/src/app/component/ticket/ticket.component.ts"
    click TicketComp "https://github.com/rashidaltayeb/queue-system/blob/main/src/app/component/ticket/ticket.component.html"
    click WaitingComp "https://github.com/rashidaltayeb/queue-system/blob/main/src/app/component/waiting/waiting.component.ts"
    click WaitingComp "https://github.com/rashidaltayeb/queue-system/blob/main/src/app/component/waiting/waiting.component.html"
    click SideNavComp "https://github.com/rashidaltayeb/queue-system/blob/main/src/app/component/side-nav/side-nav.component.ts"
    click SideNavComp "https://github.com/rashidaltayeb/queue-system/blob/main/src/app/component/side-nav/side-nav.component.html"
    click PatientService "https://github.com/rashidaltayeb/queue-system/blob/main/src/app/services/patient.service.ts"
    click DB "https://github.com/rashidaltayeb/queue-system/blob/main/db.json"
    click Env "https://github.com/rashidaltayeb/queue-system/blob/main/src/environments/environment.ts"
    click Env "https://github.com/rashidaltayeb/queue-system/blob/main/src/environments/environment.prod.ts"
    click A["API"] "angular.json"
    click A["API"] "tsconfig.json"
    click Browser "https://github.com/rashidaltayeb/queue-system/tree/main/src/assets/"

    classDef frontend fill:#E0F7FA,stroke:#006064,color:#004D40
    classDef service fill:#80DEEA,stroke:#004D40,color:#004D40
    classDef api fill:#C8E6C9,stroke:#256029,color:#1B5E20
    classDef data fill:#FFE0B2,stroke:#E65100,color:#BF360C
    classDef config fill:#FFF9C4,stroke:#F57F17,color:#E65100
    classDef external fill:#CFD8DC,stroke:#455A64,color:#263238
```
