# brunonoatto/autolog-web architecture

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

- Interactive diagram: https://gitdiagram.com/brunonoatto/autolog-web
- Repository: https://github.com/brunonoatto/autolog-web

## Overview

##### Project type and purpose
- This is a single-page application (SPA) built with React, TypeScript, and Vite.
- It serves as a garage budgeting tool: garages create/approve budgets, clients view budgets and transfer cars, and the app integrates with an external “Fipe” service for vehicle data.

##### File structure
- Top-level build/dev files: package.json, tsconfig.json, vite.config.ts, buildspec.yaml, GitHub Actions workflows, ESLint/Prettier/Husky configs.
- Public assets: public/, index.html, index.css, tailwind.config.ts.
- Source code lives under src/:
- main.tsx & app.tsx bootstrap the React app
- core/ holds cross-cutting layers:
– api/ (an HTTP client and typed API wrappers per domain)
– models/ (TypeScript domain models)
– service/ (hooks and functions implementing business use cases)
– store/ (React Contexts and global state hooks)
– router/ (React Router wrappers & protected routes)
- layout/ contains the application chrome (headers, footers, menus)
- modules/ implements feature pages grouped by domain: auth, client, garage, landing, without-login flows
- shared/ contains reusable UI components, a design system, form validations, helpers, and types
- src/e2e/ holds Playwright end-to-end tests, fixtures, mocks, and pages

##### README for additional insights
- The README describes the underlying Vite + React + TS scaffold and hints at ESLint/CI best practices.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% User and Browser
    User["User"]:::external
    Browser["Browser"]:::external

    User -->|"interacts with"| Browser
    Browser -->|"loads SPA"| SPAApp

    %% SPA Application Container
    subgraph "React SPA Application"
        direction TB

        %% Entry Points
        subgraph "App Bootstrap" 
            direction TB
            Main["main.tsx"]:::presentation
            AppEntry["app.tsx"]:::presentation
        end

        %% Presentation Layer
        subgraph "Presentation Layer" 
            direction TB
            Modules["Feature Modules"]:::presentation
            Layout["Layout Components"]:::presentation
            SharedComp["Shared UI Components"]:::presentation
            DesignSys["Design System"]:::presentation
            Router["Router (& Protected Routes)"]:::presentation
        end

        %% State & Service Layers
        subgraph "State & Service Layers"
            direction TB
            subgraph "State Layer"
                direction TB
                Contexts["Context Providers"]:::state_service
                Hooks["Global State Hooks"]:::state_service
            end
            subgraph "Service Layer"
                direction TB
                Services["Business Logic Hooks"]:::state_service
            end
        end

        %% API Layer
        subgraph "API Layer"
            direction TB
            HttpClient["http-client.ts"]:::api
            DomainAPIs["Domain API Wrappers"]:::api
        end
    end

    %% External and Backend Systems
    subgraph "External & Backend Services"
        direction TB
        BackendAPI["Backend API"]:::external
        FipeAPI["Fipe External API"]:::external
    end

    %% CI/CD Pipeline
    subgraph "CI/CD Pipeline" 
        direction TB
        GitHubActions["GitHub Actions (ci.yaml)"]:::infra
        CodeBuild["AWS CodeBuild (buildspec.yaml)"]:::infra
    end

    %% E2E Test Harness
    subgraph "E2E Test Harness"
        direction TB
        Playwright["Playwright Suite"]:::infra
        Fixtures["Fixtures & Mocks"]:::infra
        PageObjects["Page Objects"]:::infra
    end

    %% Data Flows
    SPAApp["SPA Application"]:::presentation

    Browser -->|"renders"| SPAApp
    SPAApp -->|"calls hooks"| Services
    Services -->|"invoke API"| HttpClient
    HttpClient -->|"requests auth, budgets, cars, clients"| BackendAPI
    HttpClient -->|"GET /fipe data"| FipeAPI
    BackendAPI -->|"responses"| HttpClient
    FipeAPI -->|"pricing data"| HttpClient
    HttpClient -->|"returns data"| Services
    Services -->|"updates state"| Contexts
    Contexts -->|"provides data"| Modules
    Modules -->|"renders UI"| Browser

    %% CI/CD Flow
    User -->|"push code"| GitHubActions
    GitHubActions -->|"build & test"| CodeBuild
    CodeBuild -->|"deploy SPA"| SPAApp

    %% E2E Flow
    Playwright -->|"tests against"| SPAApp
    Playwright -->|"mocks via"| Fixtures
    Playwright -->|"uses"| PageObjects
    Playwright -->|"verifies backend"| BackendAPI

    %% Click Events
    click Main "https://github.com/brunonoatto/autolog-web/blob/main/src/main.tsx"
    click AppEntry "https://github.com/brunonoatto/autolog-web/blob/main/src/app.tsx"
    click Modules "https://github.com/brunonoatto/autolog-web/tree/main/src/modules"
    click Layout "https://github.com/brunonoatto/autolog-web/tree/main/src/layout"
    click SharedComp "https://github.com/brunonoatto/autolog-web/tree/main/src/shared/components"
    click DesignSys "https://github.com/brunonoatto/autolog-web/tree/main/src/shared/design-system"
    click Router "https://github.com/brunonoatto/autolog-web/blob/main/src/core/router/index.tsx"
    click HttpClient "https://github.com/brunonoatto/autolog-web/blob/main/src/core/api/http-client.ts"
    click DomainAPIs "https://github.com/brunonoatto/autolog-web/tree/main/src/core/api"
    click Contexts "https://github.com/brunonoatto/autolog-web/tree/main/src/core/store/context"
    click Hooks "https://github.com/brunonoatto/autolog-web/tree/main/src/core/store/hooks"
    click Services "https://github.com/brunonoatto/autolog-web/tree/main/src/core/service"
    click GitHubActions "https://github.com/brunonoatto/autolog-web/blob/main/.github/workflows/ci.yaml"
    click CodeBuild "https://github.com/brunonoatto/autolog-web/blob/main/buildspec.yaml"
    click Playwright "https://github.com/brunonoatto/autolog-web/tree/main/src/e2e"

    %% Styles
    classDef presentation fill:#D0EBFF,stroke:#1C7CD6,color:#000
    classDef state_service fill:#E3FCEF,stroke:#2F855A,color:#000
    classDef api fill:#FFF9DB,stroke:#D69E2E,color:#000
    classDef external fill:#FFE3E3,stroke:#C53030,color:#000
    classDef infra fill:#EDF2F7,stroke:#4A5568,color:#000
```
