# camptocamp/terraboard architecture

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

- Interactive diagram: https://gitdiagram.com/camptocamp/terraboard
- Repository: https://github.com/camptocamp/terraboard

## Overview

##### Main Components Overview

The system architecture should be divided into these primary components:

a) Frontend Layer:
- Vue.js based web interface (located in /static/terraboard-vuejs)
- Components for state visualization, comparison, and search
- Client-side routing and state management

b) Backend Layer:
- Go server (main application)
- REST API endpoints
- State management and processing logic
- Provider integrations

c) Storage Layer:
- PostgreSQL database for internal state storage
- Multiple provider support for state files:
- AWS S3 + DynamoDB
- Google Cloud Storage
- Terraform Cloud
- GitLab
- S3-compatible providers (MinIO)

##### Key Interactions to Highlight

- Frontend → Backend API calls
- Backend → Various cloud providers for state retrieval
- Backend → PostgreSQL for state storage and querying
- Background sync process between providers and database

##### Detailed Component Breakdown

- State List View
- State Details View
- Search Interface
- Compare View
- Charts/Visualization

- API Server
- State Processor
- Provider Clients
- Database Sync Service

- AWS S3/DynamoDB
- Google Cloud Storage
- Terraform Cloud
- GitLab
- MinIO

##### Important Architectural Details

Specific elements:
- Authentication proxy support
- Base URL configuration
- Database synchronization interval
- Provider-specific configuration options
- State versioning support
- Lock management

##### Technical Specifications

- Technologies used (Go, Vue.js, PostgreSQL)
- Protocol information (HTTP/HTTPS)
- Authentication methods
- File formats (.tfstate)

##### Deployment Context

Deployment options:
- Docker container configuration
- Kubernetes deployment
- Database connection details
- Network boundaries

##### The security boundary with the authentication proxy

Use standardized symbols:
- Rectangles for services
- Clouds for external services
- Padlock symbols for security boundaries

- How data flows through the system
- Where state data is stored and processed
- How different providers are integrated
- Where to add new features or modifications
- Security boundaries and authentication flow

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Frontend
        FE_Main["Frontend Interface"]:::frontend
        StateList["State List View"]:::frontend
        StateDetails["State Details View"]:::frontend
        CompareView["Compare View"]:::frontend
        SearchView["Search Interface"]:::frontend
        Charts["Charts/Visualization"]:::frontend
        
        FE_Main --> StateList
        FE_Main --> StateDetails
        FE_Main --> CompareView
        FE_Main --> SearchView
        FE_Main --> Charts
    end

    subgraph Backend
        API["API Server"]:::backend
        Auth["Authentication System"]:::security
        StateManager["State Management"]:::backend
        CompareService["State Comparison"]:::backend
        Config["Configuration"]:::backend
        
        API --> Auth
        API --> StateManager
        API --> CompareService
        API --> Config
    end

    subgraph "State Providers"
        AWS["AWS S3/DynamoDB"]:::provider
        GCP["Google Cloud Storage"]:::provider
        GitLab["GitLab"]:::provider
        TFCloud["Terraform Cloud"]:::provider
        MinIO["MinIO"]:::provider
    end

    subgraph "Storage Layer"
        DB[(PostgreSQL)]:::database
    end

    FE_Main --> API
    StateManager --> AWS
    StateManager --> GCP
    StateManager --> GitLab
    StateManager --> TFCloud
    StateManager --> MinIO
    
    API --> DB
    StateManager --> DB

    %% Click Events
    click FE_Main "https://github.com/camptocamp/terraboard/tree/master/static/terraboard-vuejs/src/"
    click StateList "https://github.com/camptocamp/terraboard/blob/master/static/terraboard-vuejs/src/components/StatesList.vue"
    click StateDetails "https://github.com/camptocamp/terraboard/blob/master/static/terraboard-vuejs/src/components/StateDetails.vue"
    click CompareView "https://github.com/camptocamp/terraboard/blob/master/static/terraboard-vuejs/src/components/StatesCompare.vue"
    click SearchView "https://github.com/camptocamp/terraboard/blob/master/static/terraboard-vuejs/src/views/Search.vue"
    click Charts "https://github.com/camptocamp/terraboard/blob/master/static/terraboard-vuejs/src/components/Charts.vue"
    click API "https://github.com/camptocamp/terraboard/blob/master/api/api.go"
    click Auth "https://github.com/camptocamp/terraboard/blob/master/auth/auth.go"
    click DB "https://github.com/camptocamp/terraboard/blob/master/db/db.go"
    click StateManager "https://github.com/camptocamp/terraboard/blob/master/state/state.go"
    click CompareService "https://github.com/camptocamp/terraboard/blob/master/compare/compare.go"
    click Config "https://github.com/camptocamp/terraboard/blob/master/config/config.go"

    %% Styling
    classDef frontend fill:#3498db,stroke:#2980b9,color:white
    classDef backend fill:#2ecc71,stroke:#27ae60,color:white
    classDef database fill:#f1c40f,stroke:#f39c12,color:black
    classDef provider fill:#9b59b6,stroke:#8e44ad,color:white
    classDef security fill:#e74c3c,stroke:#c0392b,color:white

    %% Legend
    subgraph Legend
        L_FE["Frontend"]:::frontend
        L_BE["Backend"]:::backend
        L_DB[(Database)]:::database
        L_PR["Provider"]:::provider
        L_SEC["Security"]:::security
    end
```
