# missaelhrz512/noc architecture

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

- Interactive diagram: https://gitdiagram.com/missaelhrz512/noc
- Repository: https://github.com/missaelhrz512/noc

## Overview

##### Project type and purpose
- This is a backend service built in TypeScript following a clean-architecture (onion/hexagonal) style.
- It exposes two “presentation” entry points:
- HTTP API (src/presentation/server.ts)
- Cron jobs (src/presentation/cron/cron-service.ts)
- Business logic lives in the Domain layer (src/Domain/use-cases/...).

##### File structure
- Top level
- package.json, tsconfig.json, app.ts (composition root), readme.md
- src/Domain/use-cases/checks/check-service.ts
- Contains core “check” use-case implementation
- src/presentation
- server.ts → HTTP routes/controllers
- cron/cron-service.ts → scheduled tasks

##### Key insights from the README
- “presentation” = layer closest to the user/triggers
- “Domain” = business-use-cases

##### Main components
a. Presentation Layer
- HTTP Server (Express/Fastify in server.ts)
- Cron Scheduler (cron-service.ts)
b. Application Composition (app.ts)
- Wires presentation → domain
c. Domain Layer
- CheckService use case
d. (Optional) External dependencies
- Database or external APIs if any (not shown in tree)

##### Relationships & data flows
- HTTP request → server.ts controller → invokes CheckService → returns response
- Scheduler trigger → cron-service.ts → invokes CheckService → handles result
- app.ts boots the server, registers routes, and schedules cron jobs

##### Architectural patterns & principles
- Clean/Onion architecture: clear separation between Presentation and Domain
- Dependency Inversion: Presentation depends on Domain interfaces/use-cases
- Single Responsibility: each module has one purpose

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Presentation Layer
    subgraph "Presentation Layer"
        HTTPServer["HTTP Server"]:::presentation
        CronScheduler["Cron Scheduler"]:::presentation
    end

    %% Application Layer
    subgraph "Application Layer"
        App["Composition Root (app.ts)"]:::application
    end

    %% Domain Layer
    subgraph "Domain Layer"
        CheckService["CheckService (use-case)"]:::domain
    end

    %% Connections
    HTTPServer -->|"HTTP GET /check"| App
    CronScheduler -->|"runScheduledCheck"| App
    App -->|"execute()"| CheckService

    %% Click Events
    click HTTPServer "https://github.com/missaelhrz512/noc/blob/master/src/presentation/server.ts"
    click CronScheduler "https://github.com/missaelhrz512/noc/blob/master/src/presentation/cron/cron-service.ts"
    click App "https://github.com/missaelhrz512/noc/blob/master/src/app.ts"
    click CheckService "https://github.com/missaelhrz512/noc/blob/master/src/Domain/use-cases/checks/check-service.ts"

    %% Styles
    classDef presentation fill:#a8e6cf,stroke:#379683,stroke-width:2px;
    classDef application fill:#ffd3b6,stroke:#ff8b94,stroke-width:2px;
    classDef domain fill:#83a4d4,stroke:#1e3c72,stroke-width:2px;
```
