# carlosdanieldev/ez-convert architecture

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

- Interactive diagram: https://gitdiagram.com/carlosdanieldev/ez-convert
- Repository: https://github.com/carlosdanieldev/ez-convert

## Overview

##### Project type and purpose
- From the file tree and README (“ez-convert – Um app simples para conversões fáceis”), this is a full-stack web application built on Next.js (React) with a Node.js API layer, backed by a PostgreSQL database managed via Docker Compose and JS migration scripts.

##### File structure
- Top-level directories:
- pages/ – Next.js frontend pages and API routes (pages/api/v1/…).
- infra/ – Docker Compose definitions (compose.yml), database wiring (database.js), migrations & helper scripts.
- models/ – ORM-style model layer (user.js, password.js) and migrator tooling.
- tests/ – Jest integration and unit tests.
- Config files for linting/prettier/Husky/GitHub Actions in root.
- package.json defines dependencies (Next.js, Jest, etc.)

##### README for additional insights
- The README is minimal, confirming the app’s goal is to offer simple data conversions via a web UI and REST API.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Client Layer
    subgraph "Client (Browser/UI)"
        UI["Next.js Pages & Styles"]:::ui
    end

    %% Server/API Layer
    subgraph "Server (Next.js API Layer)"
        API1["GET /api/v1/users"]:::server
        API2["GET /api/v1/users/[username]"]:::server
        API3["GET /api/v1/status"]:::server
        API4["POST /api/v1/migrations"]:::server
    end

    %% Model Layer
    subgraph "Model Layer"
        M1["models/user.js"]:::infra
        M2["models/password.js"]:::infra
        M3["models/migrator.js"]:::infra
    end

    %% Database
    subgraph "Database Service"
        DB["PostgreSQL"]:::db
    end

    %% Infrastructure
    subgraph "Infrastructure"
        COMPOSE["infra/compose.yml"]:::infra
        DBHELP["infra/database.js"]:::infra
        CTRL["infra/controller.js"]:::infra
        ERR["infra/errors.js"]:::infra
        MIG["infra/migrations/1745980192243_create-users.js"]:::infra
        SCRIPT1["infra/scripts/benchmark-time.js"]:::infra
        SCRIPT2["infra/scripts/wait-for-postgres.js"]:::infra
    end

    %% CI/CD & Tests
    subgraph "CI/CD & Testing"
        LINT[".github/workflows/linting.yaml"]:::ci
        TESTWF[".github/workflows/tests.yaml"]:::ci
        UNIT["tests/unit"]:::ci
        INTEG["tests/integration"]:::ci
        ORCH["tests/orchestrator.js"]:::ci
    end

    %% Connections
    UI -->|calls REST API| API1
    UI -->|calls REST API| API2
    UI -->|calls REST API| API3
    UI -->|calls REST API| API4

    API1 -->|uses| M1
    API2 -->|uses| M1
    API2 -->|uses| M2
    API3 -->|uses| M3
    API4 -->|uses| M3

    M1 -->|queries| DB
    M2 -->|queries| DB
    M3 -->|runs migrations on| DB

    CTRL -->|orchestrates| COMPOSE
    COMPOSE -->|starts| DB
    DBHELP -->|connects to| DB
    CTRL -->|runs| MIG
    SCRIPT2 -->|waits for| DB

    LINT -->|executes| TESTWF
    TESTWF -->|runs Docker Compose| COMPOSE
    TESTWF -->|runs| UNIT
    TESTWF -->|runs| INTEG
    TESTWF -->|runs| ORCH

    %% Click Events
    click UI "https://github.com/carlosdanieldev/ez-convert/tree/main/pages/"
    click API1 "https://github.com/carlosdanieldev/ez-convert/blob/main/pages/api/v1/users/index.js"
    click API2 "https://github.com/carlosdanieldev/ez-convert/blob/main/pages/api/v1/users/[username]/index.js"
    click API3 "https://github.com/carlosdanieldev/ez-convert/blob/main/pages/api/v1/status/index.js"
    click API4 "https://github.com/carlosdanieldev/ez-convert/blob/main/pages/api/v1/migrations/index.js"
    click M1 "https://github.com/carlosdanieldev/ez-convert/blob/main/models/user.js"
    click M2 "https://github.com/carlosdanieldev/ez-convert/blob/main/models/password.js"
    click M3 "https://github.com/carlosdanieldev/ez-convert/blob/main/models/migrator.js"
    click COMPOSE "https://github.com/carlosdanieldev/ez-convert/blob/main/infra/compose.yml"
    click DBHELP "https://github.com/carlosdanieldev/ez-convert/blob/main/infra/database.js"
    click CTRL "https://github.com/carlosdanieldev/ez-convert/blob/main/infra/controller.js"
    click ERR "https://github.com/carlosdanieldev/ez-convert/blob/main/infra/errors.js"
    click MIG "https://github.com/carlosdanieldev/ez-convert/blob/main/infra/migrations/1745980192243_create-users.js"
    click SCRIPT1 "https://github.com/carlosdanieldev/ez-convert/blob/main/infra/scripts/benchmark-time.js"
    click SCRIPT2 "https://github.com/carlosdanieldev/ez-convert/blob/main/infra/scripts/wait-for-postgres.js"
    click LINT "https://github.com/carlosdanieldev/ez-convert/blob/main/.github/workflows/linting.yaml"
    click TESTWF "https://github.com/carlosdanieldev/ez-convert/blob/main/.github/workflows/tests.yaml"
    click UNIT "https://github.com/carlosdanieldev/ez-convert/tree/main/tests/unit/"
    click INTEG "https://github.com/carlosdanieldev/ez-convert/tree/main/tests/integration/"
    click ORCH "https://github.com/carlosdanieldev/ez-convert/blob/main/tests/orchestrator.js"

    %% Styles
    classDef ui fill:#ADD8E6,stroke:#000;
    classDef server fill:#90EE90,stroke:#000;
    classDef db fill:#FFA500,stroke:#000;
    classDef infra fill:#D3D3D3,stroke:#000;
    classDef ci fill:#D8BFD8,stroke:#000;
```
