# tomasfalchini/todos architecture

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

- Interactive diagram: https://gitdiagram.com/tomasfalchini/todos
- Repository: https://github.com/tomasfalchini/todos

## Overview

##### Project type and purpose
- This is a full-stack “Todos” application organized as a monorepo (Turborepo/pnpm workspaces).
- Frontend: React + AntDesign, Vite, React Query, Axios, TypeScript.
- Backend: Node.js + Express, TypeScript, layered architecture (controllers → services → repositories → Postgres).
- Shared package: Zod schemas + types used by both front and back.

##### File structure
- Top-level directories:
- apps/api → backend service (Express server, Dockerfile, migrations, controllers, middleware, routes).
- apps/web → frontend (React app, Vite config, nginx config for production).
- packages/shared → Zod schemas & TypeScript types.
- Supporting files: docker-compose.yaml orchestrates three containers (api, web, postgres).
- Build tooling: Makefile targets (dev, build, docker-up), .eslintrc, prettier, TS config, turbo.json.

##### README for architecture and stack insights
- Confirms monorepo layout, technology choices, API endpoints, dev/workflow commands, and Docker setup with Postgres.

##### Detail without over-splitting
- Every architectural layer (middleware, services, migrations) but group related files.
- Shared code usage and Docker orchestration.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% User
    User["User's Browser"]:::user

    %% Frontend Service
    subgraph "Frontend (apps/web)"
        direction TB
        Vite["Vite Dev Server"]:::frontend
        Main["Entry (main.tsx)"]:::frontend
        React["React App (App.tsx)"]:::frontend
        Router["Routing (Router.tsx)"]:::frontend
        Components["UI Components"]:::frontend
        Features["Todos Feature"]:::frontend
        ApiClient["API Client Services"]:::frontend
        Context["Context & Providers"]:::frontend
        Nginx["Nginx Config (default.conf)"]:::frontend
    end

    %% Backend Service
    subgraph "Backend (apps/api)"
        direction TB
        Express["Express Server (server.ts)"]:::backend
        Config["Configuration (config/index.ts)"]:::backend
        Middleware["HTTP Middleware"]:::backend
        Routes["Route Definitions"]:::backend
        Controllers["REST Controllers"]:::backend
        Services["Business Services"]:::backend
        Repositories["Data Repositories"]:::backend
        Models["Data Models"]:::backend
        DBAdapter["DB Adapter (PostgresDatabase.ts)"]:::backend
        Migrations["Database Migrations"]:::backend
    end

    %% Shared Library
    Shared["Shared Zod Schemas & Types"]:::shared

    %% Database
    Postgres["Postgres DB"]:::db

    %% Dev Tools & Orchestration
    subgraph "Dev Tools & Orchestration"
        direction TB
        DockerCompose["docker-compose.yaml"]:::devtools
        MakefileNode["Makefile"]:::devtools
        Monorepo["pnpm-workspace.yaml & turbo.json"]:::devtools
    end

    %% Connections
    User -->|"HTTP"| Vite
    Vite --> Main
    Main --> React
    React --> Router
    Router --> Components
    Components --> Features
    Features --> ApiClient
    ApiClient --> Express
    Express --> Middleware
    Middleware --> Routes
    Routes --> Controllers
    Controllers --> Services
    Services --> Repositories
    Repositories --> DBAdapter
    DBAdapter --> Postgres
    Controllers --> Shared
    ApiClient --> Shared

    DockerCompose --> Express
    DockerCompose --> Nginx
    DockerCompose --> Postgres
    MakefileNode --> DockerCompose
    Monorepo --> MakefileNode

    %% Click Events - Frontend
    click Vite "https://github.com/tomasfalchini/todos/blob/main/apps/web/vite.config.ts"
    click Main "https://github.com/tomasfalchini/todos/blob/main/apps/web/src/main.tsx"
    click React "https://github.com/tomasfalchini/todos/blob/main/apps/web/src/app/App.tsx"
    click Router "https://github.com/tomasfalchini/todos/blob/main/apps/web/src/app/Router.tsx"
    click Components "https://github.com/tomasfalchini/todos/tree/main/apps/web/src/components"
    click Features "https://github.com/tomasfalchini/todos/tree/main/apps/web/src/features/todos"
    click ApiClient "https://github.com/tomasfalchini/todos/blob/main/apps/web/src/services/index.ts"
    click Context "https://github.com/tomasfalchini/todos/tree/main/apps/web/src/context"
    click Nginx "https://github.com/tomasfalchini/todos/blob/main/apps/web/nginx/default.conf"
    click GlobalFrontend "https://github.com/tomasfalchini/todos/tree/main/apps/web"

    %% Click Events - Backend
    click Express "https://github.com/tomasfalchini/todos/tree/main/apps/api"
    click Config "https://github.com/tomasfalchini/todos/blob/main/apps/api/src/config/index.ts"
    click Middleware "https://github.com/tomasfalchini/todos/tree/main/apps/api/src/http/middleware"
    click Routes "https://github.com/tomasfalchini/todos/tree/main/apps/api/src/http/routes"
    click Controllers "https://github.com/tomasfalchini/todos/tree/main/apps/api/src/http/controller"
    click Services "https://github.com/tomasfalchini/todos/tree/main/apps/api/src/http/services"
    click Repositories "https://github.com/tomasfalchini/todos/tree/main/apps/api/src/database/repositories"
    click Models "https://github.com/tomasfalchini/todos/tree/main/apps/api/src/database/models"
    click DBAdapter "https://github.com/tomasfalchini/todos/blob/main/apps/api/src/database/PostgresDatabase.ts"
    click Migrations "https://github.com/tomasfalchini/todos/tree/main/apps/api/src/database/migrations"

    %% Click Events - Shared
    click Shared "https://github.com/tomasfalchini/todos/blob/main/packages/shared/src/schemas.ts"
    click Shared "https://github.com/tomasfalchini/todos/blob/main/packages/shared/src/index.ts"

    %% Click Events - Dev Tools
    click DockerCompose "https://github.com/tomasfalchini/todos/blob/main/docker-compose.yaml"
    click MakefileNode "https://github.com/tomasfalchini/todos/tree/main/Makefile"
    click Monorepo "https://github.com/tomasfalchini/todos/blob/main/pnpm-workspace.yaml"
    click Monorepo "https://github.com/tomasfalchini/todos/blob/main/turbo.json"

    %% Styles
    classDef frontend fill:#87CEFA,stroke:#333,stroke-width:1px
    classDef backend fill:#90EE90,stroke:#333,stroke-width:1px
    classDef db fill:#f96,stroke:#333,stroke-width:1px
    classDef shared fill:#D3D3D3,stroke:#333,stroke-width:1px
    classDef devtools fill:#fff,stroke:#666,stroke-dasharray:5 5
    classDef user fill:#ADD8E6,stroke:#333,stroke-width:1px
```
