# coursesbeto/node-console-app architecture

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

- Interactive diagram: https://gitdiagram.com/coursesbeto/node-console-app
- Repository: https://github.com/coursesbeto/node-console-app

## Overview

##### Project type and purpose
- This is a Node.js + TypeScript backend application (“Node-ts-multiplication-app”) whose main responsibility is to generate multiplication tables and persist them to disk.
- It exposes two “faces”:
- A CLI-style interface driven by command-line arguments (via the args.plugin)
- An HTTP interface (via server-app.ts)

##### File structure
Top level
- package.json, tsconfig.json, jest.config.ts, nodemon.json – standard Node/TS setup + test configuration
- src/app.ts & src/app.logic.ts – application entry points and core orchestrator
- src/config/plugins/args.plugin.ts – input parsing plugin (CLI arguments)
- src/domain/use-cases – pure business logic (create-table and save-file)
- src/presentation/server-app.ts – HTTP server setup (likely Express or similar)

##### README for additional insights
- Very brief: “npm install” then “npm run dev.”

##### Elements
- Labels for each component (e.g., “CreateTableUseCase”, “SaveFileUseCase”)
- Blue rectangles for Presentation
- Green for Application
- Yellow for Domain
[Clients]
↳ [Presentation Layer]
↳ [Application Layer]
↳ [Domain Layer]
↳ [Infrastructure Layer]

##### Detailed but focused
- Don’t over-partition: show only the two use-cases, the args plugin, server-app, app.logic, and FS.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Clients Layer
    subgraph "Clients"
        direction TB
        CLI["CLI (stdin/argv)"]:::client
        HTTPClient["HTTP Client (Postman/Browser)"]:::client
    end

    %% Presentation Layer
    subgraph "Presentation Layer"
        direction TB
        ArgsPlugin["Args Plugin"]:::presentation
        ServerApp["Server Application"]:::presentation
    end

    %% Application Layer
    subgraph "Application Layer"
        direction TB
        AppEntry["App Entry Point"]:::application
        AppLogic["Application Orchestrator"]:::application
    end

    %% Domain Layer
    subgraph "Domain Layer"
        direction TB
        CreateTable["CreateTableUseCase"]:::domain
        SaveFile["SaveFileUseCase"]:::domain
    end

    %% Infrastructure Layer
    subgraph "Infrastructure"
        direction TB
        FileSystem["Filesystem (Disk)"]:::infra
    end

    %% Flows
    CLI -->|invokes| ArgsPlugin
    HTTPClient -->|sends HTTP request| ServerApp
    ArgsPlugin -->|calls| AppEntry
    ServerApp -->|routes to| AppEntry
    AppEntry -->|orchestrates| AppLogic
    AppLogic -->|executes| CreateTable
    AppLogic -->|executes| SaveFile
    SaveFile -->|writes to| FileSystem

    %% Click Events
    click ArgsPlugin "https://github.com/coursesbeto/node-console-app/blob/main/src/config/plugins/args.plugin.ts"
    click ServerApp "https://github.com/coursesbeto/node-console-app/blob/main/src/presentation/server-app.ts"
    click AppEntry "https://github.com/coursesbeto/node-console-app/blob/main/src/app.ts"
    click AppLogic "https://github.com/coursesbeto/node-console-app/blob/main/src/app.logic.ts"
    click CreateTable "https://github.com/coursesbeto/node-console-app/blob/main/src/domain/use-cases/create-table.use-case.ts"
    click SaveFile "https://github.com/coursesbeto/node-console-app/blob/main/src/domain/use-cases/save-file.use-case.ts"

    %% Styles
    classDef client fill:#f9c2ff,stroke:#333,stroke-width:1px;
    classDef presentation fill:#c2e0ff,stroke:#333,stroke-width:1px;
    classDef application fill:#c2ffc2,stroke:#333,stroke-width:1px;
    classDef domain fill:#fff5c2,stroke:#333,stroke-width:1px;
    classDef infra fill:#d3d3d3,stroke:#333,stroke-width:1px;
```
