# syeo66/adventure architecture

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

- Interactive diagram: https://gitdiagram.com/syeo66/adventure
- Repository: https://github.com/syeo66/adventure

## Overview

##### Main Components

a) Client-Side Components:
- Console Interface (User Input/Output)
- Game Engine (Rust Application)
- Configuration Manager (INI file handler)

b) External Services:
- OpenAI API Service
- Anthropic API Service (alternative)

c) Storage:
- Local Configuration File (~/.adventure.ini)

##### Application Layer (Core Game Engine)
- Sub-components:
- Input Handler
- Game State Manager
- AI Response Processor
- Configuration Reader

##### External Services Layer
- AI services at the bottom
- Both OpenAI and Anthropic APIs as alternative paths

##### Component Relationships

- User input flow: Console → Game Engine
- Configuration flow: INI File → Configuration Reader → Game Engine
- AI interaction flow: Game Engine → AI Services
- Response flow: AI Services → Game Engine → Console

##### Additional Details

Technical specifications in notes or labels:
- Rust runtime environment
- API authentication flow
- Configuration file format
- Console I/O handling

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles
    classDef console fill:#d4e6ff,stroke:#333
    classDef core fill:#b3d1ff,stroke:#333
    classDef external fill:#90EE90,stroke:#333
    classDef storage fill:#FFE4B5,stroke:#333
    classDef config fill:#FFB6C1,stroke:#333

    %% Presentation Layer
    Console["Console Interface"]:::console

    %% Application Layer
    subgraph GameEngine["Game Engine"]
        InputHandler["Input Handler"]:::core
        GameState["Game State Manager"]:::core
        AIProcessor["AI Response Processor"]:::core
        ConfigReader["Configuration Reader"]:::core
    end

    %% Storage Layer
    Config["Local Configuration\n~/.adventure.ini"]:::storage

    %% External Services Layer
    subgraph AIServices["AI Services"]
        OpenAI["OpenAI API"]:::external
        Anthropic["Anthropic API"]:::external
    end

    %% Relationships
    Console --> InputHandler
    InputHandler --> GameState
    GameState --> AIProcessor
    AIProcessor --> |API Calls| OpenAI
    AIProcessor --> |Alternative API| Anthropic
    OpenAI --> |Response| AIProcessor
    Anthropic --> |Response| AIProcessor
    AIProcessor --> GameState
    GameState --> Console
    Config -.- |Read| ConfigReader
    ConfigReader --> GameState

    %% Click Events
    click GameEngine "https://github.com/syeo66/adventure/blob/main/src/main.rs"
    click AIServices "https://github.com/syeo66/adventure/blob/main/Cargo.toml"

    %% Legend
    subgraph Legend
        L1["Local Component"]:::core
        L2["External Service"]:::external
        L3["Storage"]:::storage
        L4["Console I/O"]:::console
    end
```
