# ecstaticsites/go architecture

> Architecture diagram of the GitHub repository ecstaticsites/go, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ecstaticsites/go
- Repository: https://github.com/ecstaticsites/go

## Overview

##### Main Components Identification

The project appears to be a service-oriented application with several distinct components. Here's how to represent the main components:

a) Command Services (Primary Components):
- API Service
- Git Service
- Intake Service
- Query Service

b) Client Integrations:
- Bunny Admin Client
- Supabase Admin Client
- Supabase Normal User Client

c) External Services Integration:
- Bunny (likely for CDN/storage)
- Supabase (for authentication/database)
- InfluxDB (for querying/metrics)

##### Component Relationships

- Service dependencies
- Data flow
- Authentication flow
- Client-service interactions

##### Specific Implementation Details

a) Authentication Flow:
- Auth flow through the util/auth.go and util/claims.go components
- Supabase integration for user management

b) Data Processing Flow:
- Intake service's enrichment process (intake/enriched.go)
- Listener and tagger components in the intake service

c) API Layer:
- Demonstrate how the API service interfaces with other components
- Routing and endpoint structure

##### Additional Elements

Supporting elements:

b) Infrastructure Indicators:
- Docker container boundaries (referenced by Dockerfile)
- CI/CD pipeline connection (.github/workflows)

##### Technical Stack Indicators

Technology indicators:
- Golang runtime
- Docker containerization
- InfluxDB for querying
- Supabase for auth/data
- Bunny for content delivery

Remember to include version control integration (git service) and show how it fits into the overall architecture, as it seems to be a key component based on the file structure.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Clients
        BA[Bunny Admin Client]
        SA[Supabase Admin Client]
        SN[Supabase Normal User Client]
    end

    subgraph "Core Services"
        API[API Service]
        GIT[Git Service]
        INTAKE[Intake Service]
        QUERY[Query Service]
    end

    subgraph "Intake Components"
        ENRICH[Enrichment]
        LISTEN[Listener]
        INTAKER[Intake Handler]
    end

    subgraph "Git Components"
        MIDDLEWARE[Git Middleware]
        TEMPLATE[Git Template Handler]
    end

    subgraph "Utility Layer"
        AUTH[Authentication]
        CLAIMS[Claims Handler]
        ENV[Environment Config]
        RANDOM[Random Utils]
    end

    subgraph "External Services"
        BUNNY[("Bunny CDN")]
        SUPABASE[("Supabase")]
        INFLUX[("InfluxDB")]
    end

    %% Relationships
    BA --> API
    SA --> API
    SN --> API

    API --> AUTH
    GIT --> AUTH
    INTAKE --> AUTH
    QUERY --> AUTH

    AUTH --> CLAIMS
    AUTH --> ENV

    INTAKE --> ENRICH
    INTAKE --> LISTEN
    INTAKE --> INTAKER
    INTAKE --> BUNNY

    GIT --> MIDDLEWARE
    GIT --> TEMPLATE

    QUERY --> INFLUX

    %% Styling
    classDef default fill:#f9f9f9,stroke:#333,stroke-width:2px
    classDef external fill:#ddd,stroke:#333,stroke-width:2px
    classDef utility fill:#e1f5fe,stroke:#333,stroke-width:2px
    classDef service fill:#c8e6c9,stroke:#333,stroke-width:2px
    classDef client fill:#fff9c4,stroke:#333,stroke-width:2px

    class BUNNY,SUPABASE,INFLUX external
    class AUTH,CLAIMS,ENV,RANDOM utility
    class API,GIT,INTAKE,QUERY service
    class BA,SA,SN client

    %% Click Events
    click BA "https://github.com/ecstaticsites/go/blob/main/client/bunny_admin.go"
    click SA "https://github.com/ecstaticsites/go/blob/main/client/supabase_admin.go"
    click SN "https://github.com/ecstaticsites/go/blob/main/client/supabase_normie.go"
    click API "https://github.com/ecstaticsites/go/blob/main/cmd/api/api.go"
    click GIT "https://github.com/ecstaticsites/go/blob/main/cmd/git/cmd.go"
    click INTAKE "https://github.com/ecstaticsites/go/blob/main/cmd/intake/cmd.go"
    click QUERY "https://github.com/ecstaticsites/go/blob/main/cmd/query/cmd.go"
    click ENRICH "https://github.com/ecstaticsites/go/blob/main/cmd/intake/enirched.go"
    click LISTEN "https://github.com/ecstaticsites/go/blob/main/cmd/intake/listener.go"
    click INTAKER "https://github.com/ecstaticsites/go/blob/main/cmd/intake/intaker.go"
    click MIDDLEWARE "https://github.com/ecstaticsites/go/blob/main/cmd/git/middlewarer.go"
    click TEMPLATE "https://github.com/ecstaticsites/go/blob/main/cmd/git/template.go"
    click AUTH "https://github.com/ecstaticsites/go/blob/main/util/auth.go"
    click CLAIMS "https://github.com/ecstaticsites/go/blob/main/util/claims.go"
    click ENV "https://github.com/ecstaticsites/go/blob/main/util/env.go"
    click RANDOM "https://github.com/ecstaticsites/go/blob/main/util/random.go"
```
