# josholaus/doofus-rick architecture

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

- Interactive diagram: https://gitdiagram.com/josholaus/doofus-rick
- Repository: https://github.com/josholaus/doofus-rick

## Overview

##### Main System Components
The project appears to be a full-stack application with three main components:

a. Discord Bot Server (./server)
b. Web Application (./app)
c. Database (implied by Database.ts)

##### Component Relationships

- API calls between frontend and Elysia server
- Discord bot interaction with Discord API
- Database interactions from both web and bot services

##### Detailed Component Breakdown

Frontend (Blue Section):
**Web Application (SvelteKit)**
- Routes
- Home Page
- Quote View
- Random Quote
- Components
- UI Elements
- API Integration

Backend (Green Section):
**Server**
- Elysia Server
- Quote Plugin
- Discord Plugin
- Discord Bot
- Command Registry
- Task Scheduler
- Listeners
- Database Interface

##### Technical Stack Indicators

Technology badges or labels for:
- SvelteKit
- Elysia
- Discord.js
- Tailwind CSS
- Bun (as indicated by bun.lockb files)
- TypeScript

##### Data Flow Patterns

Key flows:
- User interactions with web interface
- Discord command processing
- Scheduled task execution
- Database operations
- Auto-response handling

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Frontend
        WA["Web Application (SvelteKit)"]
        Routes["Frontend Routes"]
        UI["UI Components"]
        API["API Integration Layer"]
        
        WA --> Routes
        WA --> UI
        WA --> API
    end

    subgraph Backend
        ES["Elysia Server"]
        PS["Plugin System"]
        
        subgraph "Discord Bot"
            DBC["Discord Bot Client"]
            CR["Command Registry"]
            TS["Task Scheduler"]
            ARS["Auto-Response System"]
            DC["Discord Commands"]
            ST["Scheduled Tasks"]
            DL["Discord Listeners"]
            
            DBC --> CR
            DBC --> TS
            DBC --> ARS
            CR --> DC
            TS --> ST
            DBC --> DL
        end
        
        ES --> PS
        PS --> DBC
    end

    subgraph Database
        DI["Database Interface"]
        QM["Quote Model"]
        
        DI --> QM
    end

    API --> ES
    ES --> DI
    DBC --> DI

    %% Click events for component mapping
    click WA "https://github.com/josholaus/doofus-rick/tree/main/app"
    click Routes "https://github.com/josholaus/doofus-rick/tree/main/app/src/routes"
    click UI "https://github.com/josholaus/doofus-rick/tree/main/app/src/components/ui"
    click API "https://github.com/josholaus/doofus-rick/blob/main/app/src/lib/eden.ts"
    click ES "https://github.com/josholaus/doofus-rick/blob/main/server/src/elysia/Server.ts"
    click DBC "https://github.com/josholaus/doofus-rick/blob/main/server/src/discord/Client.ts"
    click CR "https://github.com/josholaus/doofus-rick/blob/main/server/src/discord/CommandRegistry.ts"
    click TS "https://github.com/josholaus/doofus-rick/blob/main/server/src/discord/TaskScheduler.ts"
    click ARS "https://github.com/josholaus/doofus-rick/blob/main/server/src/discord/listener/AutoResponseListener.ts"
    click PS "https://github.com/josholaus/doofus-rick/tree/main/server/src/elysia/plugins"
    click DI "https://github.com/josholaus/doofus-rick/blob/main/server/src/common/Database.ts"
    click QM "https://github.com/josholaus/doofus-rick/blob/main/server/src/common/Quote.ts"
    click DC "https://github.com/josholaus/doofus-rick/tree/main/server/src/discord/commands"
    click ST "https://github.com/josholaus/doofus-rick/tree/main/server/src/discord/tasks"
    click DL "https://github.com/josholaus/doofus-rick/tree/main/server/src/discord/listener"

    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 discord fill:#7289da,stroke:#5b6eae,color:white

    class WA,Routes,UI,API frontend
    class ES,PS backend
    class DBC,CR,TS,ARS,DC,ST,DL discord
    class DI,QM database
```
