# anvayb/trackflow architecture

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

- Interactive diagram: https://gitdiagram.com/anvayb/trackflow
- Repository: https://github.com/anvayb/trackflow

## Overview

##### Project type and purpose
- TrackFlow is a full-stack, microservices-based logistics tracking platform.
- It provides order management, invoice generation, notifications, and integrates with AWS in production.

##### File structure
- Top-level files: Makefile (orchestrates local vs. prod), docker.compose.yml (local multi-container), GitHub workflows (CI/CD).
- Microservices folders:
- orders/ (Node.js service on port 3001)
- invoices/ (Node.js service on port 3003, writes PDFs to local exports or S3)
- notifications/ (Node.js service on port 4000, sends emails via SES)
- Frontend folder: React+TypeScript app built with Vite, communicates with services.
- No dedicated “shared” library—each service has its own package.json/node_modules.

##### README for additional insights
- Development: in-memory storage, local Docker Compose.
- Production: AWS DynamoDB (orders + customers), S3 (invoices), SES (emails).
- Entry points:
- orders: server.js exposes REST endpoints
- invoices: server.js endpoint to generate PDF by calling orders and persisting to S3 or local FS
- notifications: server.js sends transactional emails

##### Detailed but concise
- Local vs. cloud storage differences.
- Docker Compose network overlay for local.
- CI/CD pipelines as side note (GitHub Actions).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Client Layer
    subgraph "Client Layer"
        Browser["Browser"]:::client
    end

    %% Frontend Layer
    subgraph "Frontend Layer"
        Frontend["Frontend (React + Vite)"]:::frontend
    end

    %% Local Dev Environment
    subgraph "Local Dev (Docker Compose)"
        direction TB
        Orders["Orders Service\n(Node.js + Express)"]:::service
        Invoices["Invoices Service\n(Node.js + Express)"]:::service
        Notifications["Notifications Service\n(Node.js + Express)"]:::service
        LocalFS["Local File Storage"]:::db
        InMemory["In-Memory DB"]:::db
    end

    %% Production Environment
    subgraph "Production Cloud (AWS)"
        direction TB
        DynamoDB["DynamoDB"]:::db
        S3["S3 Bucket"]:::aws
        SES["SES (Email)"]:::aws
    end

    %% CI/CD Pipelines
    subgraph "CI/CD (GitHub Actions)"
        DeployOrders["deploy-orders.yml"]:::pipeline
        DeployInvoices["deploy-invoices.yml"]:::pipeline
        DeployNotifications["deploy-notifications.yml"]:::pipeline
    end

    %% Orchestration
    Makefile["Makefile"]:::pipeline
    DockerCompose["docker.compose.yml"]:::pipeline

    %% Connections - Client to Frontend
    Browser -->|"HTTP Requests"| Frontend

    %% Frontend to Services
    Frontend -->|"REST CRUD"| Orders
    Frontend -->|"POST /generate/:orderId"| Invoices

    %% Service-to-Service Calls
    Invoices -->|"GET /orders/:id"| Orders
    Invoices -->|"WRITE PDF"| LocalFS
    Invoices -->|"UPLOAD PDF"| S3
    Invoices -->|"TRIGGER email"| Notifications

    %% Orders Service Data Store
    Orders -->|"READ/WRITE"| InMemory
    Orders -->|"READ/WRITE"| DynamoDB

    %% Notifications Service to SES
    Notifications -->|"SEND email"| SES

    %% CI/CD to Services
    DeployOrders --> Orders
    DeployInvoices --> Invoices
    DeployNotifications --> Notifications

    %% Orchestration Tools
    Makefile --> DockerCompose
    DockerCompose --> Orders
    DockerCompose --> Invoices
    DockerCompose --> Notifications

    %% Click Events
    click Frontend "https://github.com/anvayb/trackflow/tree/main/frontend/"
    click Browser "https://github.com/anvayb/trackflow/blob/main/frontend/src/App.tsx"
    click Orders "https://github.com/anvayb/trackflow/tree/main/orders/"
    click Invoices "https://github.com/anvayb/trackflow/tree/main/invoices/"
    click Notifications "https://github.com/anvayb/trackflow/tree/main/notifications/"
    click DeployOrders "https://github.com/anvayb/trackflow/blob/main/.github/workflows/deploy-orders.yml"
    click DeployInvoices "https://github.com/anvayb/trackflow/blob/main/.github/workflows/deploy-invoices.yml"
    click DeployNotifications "https://github.com/anvayb/trackflow/blob/main/.github/workflows/deploy-notifications.yml"
    click DockerCompose "https://github.com/anvayb/trackflow/blob/main/docker.compose.yml"
    click Makefile "https://github.com/anvayb/trackflow/tree/main/Makefile"

    %% Styles
    classDef client fill:#DDEBF7,stroke:#000,color:#000;
    classDef frontend fill:#B4C7E7,stroke:#000,color:#000;
    classDef service fill:#C6E0B4,stroke:#000,color:#000;
    classDef aws fill:#FFD966,stroke:#000,color:#000;
    classDef db fill:#FFD966,stroke:#000,color:#000,shape:cylinder;
    classDef pipeline fill:#F4B183,stroke:#000,color:#000;
```
