# acwilliam/app-pibg-gerenciamento architecture

> Architecture diagram of the GitHub repository acwilliam/app-pibg-gerenciamento, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/acwilliam/app-pibg-gerenciamento
- Repository: https://github.com/acwilliam/app-pibg-gerenciamento

## Overview

##### Main System Type & Purpose
- This is a full-stack-style, single-page Angular application (front end) generated by Angular CLI v18.2.5.
- It provides user interfaces for registration, meeting scheduling, check-in/out, PDF and QR generation, and more.
- It relies on external RESTful APIs (defined in app.config.server.ts) to persist data (users, events, rooms, participants).

##### File Structure
Top-level directories & files:
- src/app: the Angular application code
– app.module.ts, app-routing.module.ts: central module & routes
– componentes/: feature components (Cadastro, Login, Reuniões, etc.)
– services modules: HTTP/utility services (cadastro.service, email-data.service, qrcode.service, etc.)
– pipes/, diretivas/, modais/: custom pipes, directives, modal components
- public/: PWA manifest
- src/environments: env-specific constants (API endpoints)
- angular.json, package.json: build/dependency configs

##### Extract Architecture Insights from README
- Standard Angular development/build/testing workflow (ng serve, ng build, ng test, ng e2e).
- No embedded back-end: expects separate API layer.

##### Main Components & Their Interactions
a. Presentation Layer (Browser & Angular SPA)
– User’s Browser hosting index.html → main.ts bootstraps AppModule
– RouterOutlet directs to feature components under src/app/componentes
– UI components use Angular Material/dialogs or custom directives/pipes
b. Application Layer (Components & Services)
– Components invoke injected Services via Dependency Injection (e.g., CadastroService, PessoaService, PdfService, QrcodeService).
– Services use Angular HttpClient to send/receive JSON to/from external backend.
c. External Services Layer (Back-End API & Database)
– Configured in app.config.server.ts and environment.ts (URLs, tokens)
– Typical REST endpoints: /users, /meetings, /rooms, /attendance
– Underlying Back-End (Node.js/Java/.NET/PHP) interacts with relational or NoSQL database.
d. Optional PWA Features
– ngsw-config.json: Angular Service Worker for offline caching of assets & API calls.

##### Relationships & Data Flows
1. User ↔ Browser ↔ Angular Components
2. Components → Services (HTTP client calls)
3. Services → External REST API
4. External REST API → Database
5. Responses flow back up through the same chain

##### Architectural Patterns & Design Principles
– Component-based UI (each feature in its own folder)
– Separation of concerns: Components handle view & user interaction; Services handle data/business logic.
– Dependency Injection for testability and loose coupling.
– State/config isolation via environment files.
– Modular routing for lazy loading potential (app-routing.module.ts).

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Presentation Layer
    subgraph "Presentation Layer"
        Browser["User's Browser"]:::external
        Index["index.html"]:::frontend
        Main["main.ts"]:::frontend
        AppModule["AppModule"]:::frontend
        AppRouting["AppRoutingModule"]:::frontend
        subgraph "Feature Components"
            CadastroComp["CadastroComponent"]:::frontend
            CriarContaComp["CriarContaComponent"]:::frontend
            CriarReunioesComp["CriarReunioesComponent"]:::frontend
            ReunioesComp["ReunioesComponent"]:::frontend
            CheckInModal["CheckInModalComponent"]:::frontend
            QrcodeComp["QrCodeComponent"]:::frontend
            ConfirmDialog["ConfirmacaoDialog"]:::frontend
        end
    end

    %% Business Logic Layer
    subgraph "Business Logic Layer"
        subgraph "Authentication"
            AuthService["AuthService"]:::service
            AuthGuard["AuthGuardService"]:::service
        end
        subgraph "Feature Services"
            CadastroService["CadastroService"]:::service
            CriarContaService["CriarContaService"]:::service
            PdfService["PdfService"]:::service
            QrcodeService["QrCodeService"]:::service
            PessoaService["PessoaService"]:::service
        end
        subgraph "Core Utilities"
            EmailDataService["EmailDataService"]:::service
            AutoIncrementService["AutoIncrementIDService"]:::service
            AgeCalcService["AgeCalculationService"]:::service
            CompressService["CompressImageService"]:::service
            ValidationService["ValidacaoChecksService"]:::service
            UploadService["UploadImageService"]:::service
            UpdateService["UpdateService"]:::service
        end
        subgraph "Pipes & Directives"
            GroupByPipe["GroupByPipe"]:::service
            HasholeDir["HasholeDirective"]:::service
            MascaraTelDir["MascaraTelefoneDirective"]:::service
        end
        Models["Models (Evento, Reuniao, Frequencia, StatusCheckin)"]:::service
    end

    %% Configuration & PWA
    subgraph "Configuration"
        Env["environment.ts"]:::config
        AppConfigServer["app.config.server.ts"]:::config
        AppConfig["app.config.ts"]:::config
    end
    SW["ngsw-config.json"]:::pwa

    %% Data Persistence Layer
    subgraph "External Services"
        API["External REST API"]:::external
    end
    Database["Database"]:::db

    %% Flows
    Browser --> Index
    Index --> Main
    Main --> AppModule
    AppModule --> AppRouting
    AppRouting --> CadastroComp
    AppRouting --> CriarContaComp
    AppRouting --> ReunioesComp

    %% Component to Service
    CadastroComp -->|"injects"| CadastroService
    CriarContaComp -->|"injects"| CriarContaService
    ReunioesComp -->|"injects"| PessoaService
    QrcodeComp -->|"injects"| QrcodeService
    ConfirmDialog -->|"uses"| EmailDataService
    CheckInModal -->|"uses"| ValidationService

    %% Feature services to core utilities
    CadastroService -->|calls| HttpClient["HttpClient"]:::service
    CriarContaService -->|calls| HttpClient
    PdfService -->|generates PDF| CompressService
    QrcodeService -->|generates QR| CompressService

    %% Services to External API
    HttpClient -->|"HTTP calls"| API
    AuthService -->|"auth calls"| API
    CadastroService -->|"POST /users"| API
    CriarContaService -->|"POST /users"| API
    PessoaService -->|"GET /users"| API
    PdfService -->|"GET /pdf"| API
    QrcodeService -->|"GET /qrcode"| API

    %% API to DB
    API -->|"SQL/NoSQL operations"| Database

    %% Config injection
    Env --> AppConfigServer
    AppConfigServer --> CadastroService
    AppConfig --> HttpClient

    %% PWA caching
    SW --> Index
    SW --> API

    %% Models and Pipes/Directives usage
    Models --> CadastroComp
    Models --> ReunioesComp
    GroupByPipe --> ReunioesComp
    HasholeDir --> CadastroComp
    MascaraTelDir --> CriarContaComp

    %% Click Events
    click AppModule "https://github.com/acwilliam/app-pibg-gerenciamento/blob/master/src/app/app.module.ts"
    click AppRouting "https://github.com/acwilliam/app-pibg-gerenciamento/blob/master/src/app/app-routing.module.ts"
    click Index "https://github.com/acwilliam/app-pibg-gerenciamento/blob/master/src/index.html"
    click Main "https://github.com/acwilliam/app-pibg-gerenciamento/blob/master/src/main.ts"
    click AppConfigServer "https://github.com/acwilliam/app-pibg-gerenciamento/blob/master/src/app/app.config.server.ts"
    click AppConfig "https://github.com/acwilliam/app-pibg-gerenciamento/blob/master/src/app/app.config.ts"
    click Env "https://github.com/acwilliam/app-pibg-gerenciamento/blob/master/src/envirionments/environment.ts"
    click SW "https://github.com/acwilliam/app-pibg-gerenciamento/blob/master/ngsw-config.json"
    click AuthService "https://github.com/acwilliam/app-pibg-gerenciamento/blob/master/src/app/componentes/auth.service.ts"
    click AuthGuard "https://github.com/acwilliam/app-pibg-gerenciamento/blob/master/src/app/componentes/auth-guard.service.ts"
    click CadastroComp "https://github.com/acwilliam/app-pibg-gerenciamento/blob/master/src/app/componentes/cadastro/cadastro.component.ts"
    click CadastroService "https://github.com/acwilliam/app-pibg-gerenciamento/blob/master/src/app/componentes/cadastro.service.ts"
    click CriarContaComp "https://github.com/acwilliam/app-pibg-gerenciamento/blob/master/src/app/componentes/criar-conta/criar-conta.component.ts"
    click CriarContaService "https://github.com/acwilliam/app-pibg-gerenciamento/blob/master/src/app/componentes/criar-conta.service.ts"
    click CriarReunioesComp "https://github.com/acwilliam/app-pibg-gerenciamento/blob/master/src/app/componentes/criar-reunioes/criar-reunioes.component.ts"
    click ReunioesComp "https://github.com/acwilliam/app-pibg-gerenciamento/blob/master/src/app/componentes/reunioes/reunioes.component.ts"
    click CheckInModal "https://github.com/acwilliam/app-pibg-gerenciamento/blob/master/src/app/modais/check-in-modal/check-in-modal.component.ts"
    click PdfService "https://github.com/acwilliam/app-pibg-gerenciamento/blob/master/src/app/componentes/pdf.service.ts"
    click QrcodeComp "https://github.com/acwilliam/app-pibg-gerenciamento/blob/master/src/app/componentes/qrcode/qrcode.component.ts"
    click QrcodeService "https://github.com/acwilliam/app-pibg-gerenciamento/blob/master/src/app/componentes/qrcode.service.ts"
    click PessoaService "https://github.com/acwilliam/app-pibg-gerenciamento/blob/master/src/app/componentes/pessoa.service.ts"
    click Models "https://github.com/acwilliam/app-pibg-gerenciamento/tree/master/src/app/componentes/model"
    click ConfirmDialog "https://github.com/acwilliam/app-pibg-gerenciamento/blob/master/src/app/shared/dialogs/confirmacao-dialog/confirmacao-dialog.component.ts"
    click GroupByPipe "https://github.com/acwilliam/app-pibg-gerenciamento/blob/master/src/app/pipes/groupby.pipe.ts"
    click HasholeDir "https://github.com/acwilliam/app-pibg-gerenciamento/blob/master/src/app/diretivas/hashole.directive.ts"
    click MascaraTelDir "https://github.com/acwilliam/app-pibg-gerenciamento/blob/master/src/app/diretivas/mascara-telefone.directive.ts"
    click EmailDataService "https://github.com/acwilliam/app-pibg-gerenciamento/blob/master/src/app/componentes/email-data.service.ts"
    click AutoIncrementService "https://github.com/acwilliam/app-pibg-gerenciamento/blob/master/src/app/componentes/auto-increment-id-gerador.service.ts"
    click AgeCalcService "https://github.com/acwilliam/app-pibg-gerenciamento/blob/master/src/app/componentes/cacular-idade.service.ts"
    click CompressService "https://github.com/acwilliam/app-pibg-gerenciamento/blob/master/src/app/componentes/services/comprimir-imagem.service.ts"
    click ValidationService "https://github.com/acwilliam/app-pibg-gerenciamento/blob/master/src/app/componentes/services/validacao-checks.service.ts"
    click UploadService "https://github.com/acwilliam/app-pibg-gerenciamento/blob/master/src/app/componentes/upload-imagem.service.ts"
    click UpdateService "https://github.com/acwilliam/app-pibg-gerenciamento/blob/master/src/app/componentes/update.service.ts"

    %% Styles
    classDef frontend fill:#E3F2FD,stroke:#90CAF9,stroke-width:1px
    classDef service fill:#E8F5E9,stroke:#A5D6A7,stroke-width:1px
    classDef config fill:#FFF3E0,stroke:#FFCC80,stroke-width:1px
    classDef pwa fill:#F3E5F5,stroke:#CE93D8,stroke-width:1px
    classDef external fill:#E1F5FE,stroke:#81D4FA,stroke-width:1px
    classDef db fill:#FFFDE7,stroke:#FFF176,stroke-width:1px
```
