# shobrook/adrenaline architecture

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

- Interactive diagram: https://gitdiagram.com/shobrook/adrenaline
- Repository: https://github.com/shobrook/adrenaline

## Overview

##### File structure
- Top-level:
- `.github/ISSUE_TEMPLATE/` – issue templates for bugs and feature requests
- `README.md` – project overview & features

##### README for additional insights
- Features listed: general programming Q&A, GitHub repo Q&A, doc-site Q&A, code snippets
- Implies these architectural pieces:
- Web frontend (UI)
- API / orchestration layer
- Retrieval service (internet / knowledge-base search)
- LLM inference service
- Supporting data stores (vector DB, logs, metrics)

##### Main components
a. Frontend UI
- A React/Next.js app served via CDN
b. API Gateway / Orchestrator
- Receives user requests, routes them to appropriate backend subsystems
c. Retrieval Service
- Internet search API (e.g., Bing or Google Custom Search)
- Vector database (e.g., Pinecone/Chroma) for semantic search of past answers or docs
d. LLM Inference Service
- Large-language-model endpoint (OpenAI, Anthropic, local model)
- Prompts assembled by orchestrator
f. Data Stores & Observability
- Vector DB for embeddings
- Document store (MongoDB, PostgreSQL) for session history
- Logging & monitoring (ELK / Prometheus)
g. External Services
- Web search APIs
- Code-snippet sandbox (optional)

##### Relationships and interactions between components
- User → Frontend UI: HTTP(S) or WebSocket
- Frontend → API Gateway: REST or GraphQL
- API Gateway → Retrieval Service: synchronous call to search APIs & vector DB
- API Gateway → LLM Inference: sends combined context + user query
- LLM Inference → API Gateway: returns answer text
- All services → Logging/Monitoring

##### Architectural patterns and design principles
- Microservices or modular services (each responsibility in its own bounded context)
- API-driven design (clear separation of UI vs. backend)
- Use of RAG (Retrieval-Augmented Generation) pattern: retrieval service + LLM

##### Technologies, frameworks, and libraries
- Frontend: React / Next.js, Tailwind CSS
- API: Node.js / Express or Python / FastAPI, GraphQL
- Retrieval: Pinecone, Elasticsearch, or Chroma DB; integration with Google/Bing search
- LLM Inference: OpenAI API, LangChain, or local GPU cluster
- Observability: Prometheus & Grafana, ELK stack

- Component names match actual service names in code/config repos

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% User Layer
    U["User"]:::external

    %% Frontend Layer
    subgraph "Frontend Layer"
        UI["Frontend UI\n(React/Next.js)"]:::frontend
    end

    %% Backend Layer
    subgraph "Backend Layer"
        API["API Gateway/Orchestrator"]:::api
        RET["Retrieval Service"]:::core
        LLM["LLM Inference Service"]:::core
        DIAG["Diagram Generation Module"]:::core
    end

    %% Data Stores
    subgraph "Data Stores"
        VDB["Vector DB\n(Pinecone/Chroma)"]:::db
        DDB["Document DB\n(MongoDB/PostgreSQL)"]:::db
        LOG["Logging & Monitoring\n(ELK/Prometheus)"]:::db
    end

    %% External Services
    subgraph "External Services"
        SEARCH["Web Search API\n(Bing/Google)"]:::external
        OPENAI["OpenAI API"]:::external
    end

    %% Connections
    U -->|"HTTPS/WebSocket"| UI
    UI -->|"REST/GraphQL request"| API
    API -->|"Embedding Search"| RET
    RET -->|"Query Embeddings"| VDB
    API -->|"Search Query"| SEARCH
    API -->|"Assemble Prompt"| LLM
    LLM -->|"Answer JSON"| API
    API -->|"Diagram Request"| DIAG
    DIAG -->|"Diagram Definition"| API
    API -->|"Response (text/diagram)"| UI

    %% Persistence & Observability
    API -->|"Save session"| DDB
    API --> LOG
    RET --> LOG
    LLM --> LOG
    DIAG --> LOG

    %% Click Events
    click README "https://github.com/shobrook/adrenaline/blob/master/README.md"

    %% Styles
    classDef frontend fill:#cce5ff,stroke:#2b7bb9,color:#000;
    classDef api fill:#d4edda,stroke:#2b8a3e,color:#000;
    classDef core fill:#fff3cd,stroke:#d39e00,color:#000;
    classDef db fill:#ffe5b4,stroke:#e09b00,color:#000;
    classDef external fill:#e2e3e5,stroke:#6c757d,color:#000;
```
