# alphadostar/irisex architecture

> Architecture diagram of the GitHub repository alphadostar/irisex, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-15). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/alphadostar/irisex
- Repository: https://github.com/alphadostar/irisex

## Overview

IrisEx is an Elixir framework for event-driven chat bots. An application configures bot modules and server URLs; the runtime starts its supervisors, registers the bots, and connects a WebSocket client. Incoming events are decoded into chat context and dispatched asynchronously to registered bots, whose DSL supports event handlers, text/regex matching, conversation state, fallback behavior, and replies. The client sends text or image replies and can query the HTTP API; room-type enrichment is an optional query-backed extension. Edges reflect excerpts and README statements; unsampled example modules are not mapped in detail.

Main entry points: [`lib/iris_ex/client.ex`](https://github.com/alphadostar/irisex/blob/main/lib/iris_ex/client.ex) (WebSocket client), [`lib/iris_ex/application.ex`](https://github.com/alphadostar/irisex/blob/main/lib/iris_ex/application.ex) (App configuration), [`lib/iris_ex/bot/registry.ex`](https://github.com/alphadostar/irisex/blob/main/lib/iris_ex/bot/registry.ex) (Bot registry), [`lib/iris_ex/bot/dsl.ex`](https://github.com/alphadostar/irisex/blob/main/lib/iris_ex/bot/dsl.ex) (Bot DSL)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Runtime"]
  node_app_config["App configuration<br/>[application.ex]"]
  node_supervisor["Runtime supervisor<br/>[application.ex]"]
  node_task_supervisor["Task supervisor<br/>[application.ex]"]
end

subgraph group_bots["Bot behavior"]
  node_registry["Bot registry<br/>[registry.ex]"]
  node_bot_api["Bot API<br/>[bot.ex]"]
  node_dsl["Bot DSL<br/>[dsl.ex]"]
end

subgraph group_transport["Messaging transport"]
  node_event_dispatch["Event dispatch<br/>[client.ex]"]
  node_chat_context["Chat context<br/>[client.ex]"]
  node_websocket_client["WebSocket client<br/>[client.ex]"]
  node_http_actions["HTTP actions<br/>[client.ex]"]
end

subgraph group_state["State and configuration"]
  node_conversation_state["Conversation state<br/>[agent.ex]"]
  node_configuration["Runtime configuration<br/>[config.ex]"]
end

node_bot_modules["Bot modules"]
node_chat_server(("Chat server"))
node_http_api(("HTTP API"))

node_app_config -->|"starts runtime"| node_supervisor
node_app_config -->|"sets URLs"| node_configuration
node_app_config -->|"starts client"| node_websocket_client
node_app_config -->|"registers bots"| node_registry
node_supervisor -->|"starts child"| node_task_supervisor
node_supervisor -->|"starts child"| node_registry
node_supervisor -->|"starts child"| node_conversation_state
node_bot_api -->|"registers module"| node_registry
node_bot_api -->|"imports macros"| node_dsl
node_websocket_client -->|"receives events"| node_chat_server
node_websocket_client -->|"reads URLs"| node_configuration
node_websocket_client -->|"builds context"| node_chat_context
node_websocket_client -->|"handles frames"| node_event_dispatch
node_event_dispatch -->|"gets bots"| node_registry
node_event_dispatch -->|"starts tasks"| node_task_supervisor
node_event_dispatch -->|"dispatches events"| node_bot_modules
node_dsl -->|"reads and updates"| node_conversation_state
node_dsl -->|"sends replies"| node_http_actions
node_http_actions -->|"posts replies"| node_chat_server
node_http_actions -->|"posts queries"| node_http_api
node_http_actions -->|"reads URL"| node_configuration
node_websocket_client -->|"queries for extension"| node_http_actions

click node_app_config "https://github.com/alphadostar/irisex/blob/main/lib/iris_ex/application.ex"
click node_supervisor "https://github.com/alphadostar/irisex/blob/main/lib/iris_ex/application.ex"
click node_task_supervisor "https://github.com/alphadostar/irisex/blob/main/lib/iris_ex/application.ex"
click node_registry "https://github.com/alphadostar/irisex/blob/main/lib/iris_ex/bot/registry.ex"
click node_bot_api "https://github.com/alphadostar/irisex/blob/main/lib/iris_ex/bot.ex"
click node_dsl "https://github.com/alphadostar/irisex/blob/main/lib/iris_ex/bot/dsl.ex"
click node_event_dispatch "https://github.com/alphadostar/irisex/blob/main/lib/iris_ex/client.ex"
click node_chat_context "https://github.com/alphadostar/irisex/blob/main/lib/iris_ex/client.ex"
click node_websocket_client "https://github.com/alphadostar/irisex/blob/main/lib/iris_ex/client.ex"
click node_http_actions "https://github.com/alphadostar/irisex/blob/main/lib/iris_ex/client.ex"
click node_conversation_state "https://github.com/alphadostar/irisex/blob/main/lib/iris_ex/bot/agent.ex"
click node_configuration "https://github.com/alphadostar/irisex/blob/main/lib/iris_ex/config.ex"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_app_config,node_supervisor,node_task_supervisor toneBlue
class node_registry,node_bot_api,node_dsl toneAmber
class node_event_dispatch,node_chat_context,node_websocket_client,node_http_actions,node_chat_server,node_http_api toneMint
class node_conversation_state,node_configuration toneRose
class node_bot_modules toneIndigo
```

## Components

### Runtime

- [App configuration](https://github.com/alphadostar/irisex/blob/main/lib/iris_ex/application.ex): `lib/iris_ex/application.ex`
- [Runtime supervisor](https://github.com/alphadostar/irisex/blob/main/lib/iris_ex/application.ex): `lib/iris_ex/application.ex`
- [Task supervisor](https://github.com/alphadostar/irisex/blob/main/lib/iris_ex/application.ex): `lib/iris_ex/application.ex`

### Bot behavior

- [Bot registry](https://github.com/alphadostar/irisex/blob/main/lib/iris_ex/bot/registry.ex): `lib/iris_ex/bot/registry.ex`
- [Bot API](https://github.com/alphadostar/irisex/blob/main/lib/iris_ex/bot.ex): `lib/iris_ex/bot.ex`
- [Bot DSL](https://github.com/alphadostar/irisex/blob/main/lib/iris_ex/bot/dsl.ex): `lib/iris_ex/bot/dsl.ex`

### Messaging transport

- [Event dispatch](https://github.com/alphadostar/irisex/blob/main/lib/iris_ex/client.ex): `lib/iris_ex/client.ex`
- [Chat context](https://github.com/alphadostar/irisex/blob/main/lib/iris_ex/client.ex): `lib/iris_ex/client.ex`
- [WebSocket client](https://github.com/alphadostar/irisex/blob/main/lib/iris_ex/client.ex): `lib/iris_ex/client.ex`
- [HTTP actions](https://github.com/alphadostar/irisex/blob/main/lib/iris_ex/client.ex): `lib/iris_ex/client.ex`

### State and configuration

- [Conversation state](https://github.com/alphadostar/irisex/blob/main/lib/iris_ex/bot/agent.ex): `lib/iris_ex/bot/agent.ex`
- [Runtime configuration](https://github.com/alphadostar/irisex/blob/main/lib/iris_ex/config.ex): `lib/iris_ex/config.ex`

### Other components

- **Bot modules**
- **Chat server**
- **HTTP API**

## Connections

- App configuration → Runtime supervisor: starts runtime (evidence: `lib/iris_ex/application.ex`)
- App configuration → Runtime configuration: sets URLs (evidence: `lib/iris_ex/application.ex`)
- App configuration → WebSocket client: starts client (evidence: `lib/iris_ex/application.ex`)
- App configuration → Bot registry: registers bots (evidence: `lib/iris_ex/application.ex`)
- Runtime supervisor → Task supervisor: starts child (evidence: `lib/iris_ex/application.ex`)
- Runtime supervisor → Bot registry: starts child (evidence: `lib/iris_ex/application.ex`)
- Runtime supervisor → Conversation state: starts child (evidence: `lib/iris_ex/application.ex`)
- Bot API → Bot registry: registers module (evidence: `lib/iris_ex/bot.ex`)
- Bot API → Bot DSL: imports macros (evidence: `lib/iris_ex/bot.ex`)
- WebSocket client → Chat server: receives events (evidence: `README.md`)
- WebSocket client → Runtime configuration: reads URLs (evidence: `lib/iris_ex/client.ex`)
- WebSocket client → Chat context: builds context (evidence: `lib/iris_ex/client.ex`)
- WebSocket client → Event dispatch: handles frames (evidence: `lib/iris_ex/client.ex`)
- Event dispatch → Bot registry: gets bots (evidence: `lib/iris_ex/client.ex`)
- Event dispatch → Task supervisor: starts tasks (evidence: `lib/iris_ex/client.ex`)
- Event dispatch → Bot modules: dispatches events (evidence: `lib/iris_ex/client.ex`)
- Bot DSL → Conversation state: reads and updates (evidence: `lib/iris_ex/bot/dsl.ex`)
- Bot DSL → HTTP actions: sends replies (evidence: `lib/iris_ex/bot/dsl.ex`)
- HTTP actions → Chat server: posts replies (evidence: `lib/iris_ex/client.ex`)
- HTTP actions → HTTP API: posts queries (evidence: `lib/iris_ex/client.ex`)
- HTTP actions → Runtime configuration: reads URL (evidence: `lib/iris_ex/client.ex`)
- WebSocket client → HTTP actions: queries for extension (evidence: `lib/iris_ex/client.ex`)
