# frappe/raven architecture

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

- Interactive diagram: https://gitdiagram.com/frappe/raven
- Repository: https://github.com/frappe/raven

## Overview

Raven is an enterprise messaging platform integrated with Frappe. Users enter through the web or mobile client, select a workspace and channel or direct conversation, then exchange messages, replies, files, and reactions; supporting features include search, threads, notifications, AI agents, and Frappe integrations. The graph combines the documented product capabilities with relationships visible in the supplied excerpts and SOURCE INDEX. Several backend and client subsystems are listed but unsampled, so their internal call paths are not inferred.

Main entry points: [`raven/raven_messaging/doctype/raven_message/raven_message.py`](https://github.com/frappe/raven/blob/develop/raven/raven_messaging/doctype/raven_message/raven_message.py) (Message Lifecycle), [`apps/web/src/App.tsx`](https://github.com/frappe/raven/blob/develop/apps/web/src/App.tsx) (Web App), [`raven/ai/handler.py`](https://github.com/frappe/raven/blob/develop/raven/ai/handler.py) (AI Agents), [`apps/mobile/components/features/channels/ChannelList/ChannelsList.tsx`](https://github.com/frappe/raven/blob/develop/apps/mobile/components/features/channels/ChannelList/ChannelsList.tsx) (Channels and DMs)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_clients["User Clients"]
  node_web["Web App<br/>[App.tsx]"]
  node_mobile["Mobile App<br/>[_layout.tsx]"]
  node_workspace["Workspace Access"]
  node_webchat["Embedded Chat<br/>[App.jsx]"]
end

subgraph group_conversations["Conversation Features"]
  node_channels["Channels and DMs<br/>[ChannelsList.tsx]"]
  node_composer["Message Composer<br/>[ChatInput.tsx]"]
  node_stream["Message Stream<br/>[ChatStream.tsx]"]
  node_threads["Threads and Replies<br/>[ThreadsList.tsx]"]
  node_search["Message Search<br/>[search.py]"]
  node_media["Files and Media<br/>[Media.tsx]"]
  node_linkpreview["Link Previews<br/>[links.py]"]
end

subgraph group_platform["Frappe Messaging Core"]
  node_message["Message Lifecycle<br/>[raven_message.py]"]
  node_channel["Channel Management<br/>[raven_channel.py]"]
  node_realtime["Realtime Events<br/>[handlers.py]"]
  node_notifications["Notifications<br/>[notification.py]"]
end

subgraph group_extensions["AI and Integrations"]
  node_ai["AI Agents<br/>[handler.py]"]
  node_frappeapps["Frappe App Integration"]
  node_webhooks["Webhooks<br/>[raven_webhook.py]"]
end

node_user(("Team Member"))

node_user -->|"uses"| node_web
node_user -->|"uses"| node_mobile
node_web -.->|"opens conversations"| node_channels
node_mobile -.->|"selects workspace"| node_workspace
node_workspace -.->|"opens conversations"| node_channels
node_web -.->|"offers embedded chat"| node_webchat
node_user -->|"writes messages"| node_composer
node_composer -.->|"sends message"| node_message
node_message -.->|"updates conversation"| node_stream
node_user -->|"replies in threads"| node_threads
node_user -->|"searches messages"| node_search
node_user -->|"shares files"| node_media
node_message -->|"queues preview work"| node_linkpreview
node_message -->|"sends notifications"| node_notifications
node_message -.->|"handles AI messages"| node_ai
node_user -->|"asks agent"| node_ai
node_ai -->|"runs workflows"| node_frappeapps
node_user -->|"configures integrations"| node_webhooks
node_message -.->|"publishes events"| node_realtime
node_channel -.->|"organizes conversations"| node_channels

click node_web "https://github.com/frappe/raven/blob/develop/apps/web/src/App.tsx"
click node_mobile "https://github.com/frappe/raven/blob/develop/apps/mobile/app/%5Bsite_id%5D/_layout.tsx"
click node_workspace "https://github.com/frappe/raven/blob/develop/apps/mobile/components/features/workspaces/WorkspaceSwitcher.tsx"
click node_webchat "https://github.com/frappe/raven/blob/develop/raven/public/js/raven_chat/App.jsx"
click node_channels "https://github.com/frappe/raven/blob/develop/apps/mobile/components/features/channels/ChannelList/ChannelsList.tsx"
click node_composer "https://github.com/frappe/raven/blob/develop/apps/mobile/components/features/chat/ChatInput/ChatInput.tsx"
click node_stream "https://github.com/frappe/raven/blob/develop/apps/mobile/components/features/chat-stream/ChatStream.tsx"
click node_threads "https://github.com/frappe/raven/blob/develop/apps/mobile/components/features/threads/ThreadsList.tsx"
click node_search "https://github.com/frappe/raven/blob/develop/raven/api/search.py"
click node_media "https://github.com/frappe/raven/blob/develop/apps/mobile/components/features/media/Media.tsx"
click node_linkpreview "https://github.com/frappe/raven/blob/develop/raven/links.py"
click node_message "https://github.com/frappe/raven/blob/develop/raven/raven_messaging/doctype/raven_message/raven_message.py"
click node_channel "https://github.com/frappe/raven/blob/develop/raven/raven_channel_management/doctype/raven_channel/raven_channel.py"
click node_realtime "https://github.com/frappe/raven/blob/develop/raven/realtime/handlers.py"
click node_notifications "https://github.com/frappe/raven/blob/develop/raven/notification.py"
click node_ai "https://github.com/frappe/raven/blob/develop/raven/ai/handler.py"
click node_frappeapps "https://github.com/frappe/raven/blob/develop/raven/raven_ai/doctype/raven_ai_function/raven_ai_function.py"
click node_webhooks "https://github.com/frappe/raven/blob/develop/raven/raven_integrations/doctype/raven_webhook/raven_webhook.py"

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_web,node_mobile,node_workspace,node_webchat toneBlue
class node_channels,node_composer,node_stream,node_threads,node_search,node_media,node_linkpreview toneAmber
class node_message,node_channel,node_realtime,node_notifications toneMint
class node_ai,node_frappeapps,node_webhooks toneRose
class node_user toneIndigo
```

## Components

### User Clients

- [Web App](https://github.com/frappe/raven/blob/develop/apps/web/src/App.tsx): `apps/web/src/App.tsx`
- [Mobile App](https://github.com/frappe/raven/blob/develop/apps/mobile/app/%5Bsite_id%5D/_layout.tsx): `apps/mobile/app/[site_id]/_layout.tsx`
- [Workspace Access](https://github.com/frappe/raven/blob/develop/apps/mobile/components/features/workspaces/WorkspaceSwitcher.tsx): `apps/mobile/components/features/workspaces/WorkspaceSwitcher.tsx`
- [Embedded Chat](https://github.com/frappe/raven/blob/develop/raven/public/js/raven_chat/App.jsx): `raven/public/js/raven_chat/App.jsx`

### Conversation Features

- [Channels and DMs](https://github.com/frappe/raven/blob/develop/apps/mobile/components/features/channels/ChannelList/ChannelsList.tsx): `apps/mobile/components/features/channels/ChannelList/ChannelsList.tsx`
- [Message Composer](https://github.com/frappe/raven/blob/develop/apps/mobile/components/features/chat/ChatInput/ChatInput.tsx): `apps/mobile/components/features/chat/ChatInput/ChatInput.tsx`
- [Message Stream](https://github.com/frappe/raven/blob/develop/apps/mobile/components/features/chat-stream/ChatStream.tsx): `apps/mobile/components/features/chat-stream/ChatStream.tsx`
- [Threads and Replies](https://github.com/frappe/raven/blob/develop/apps/mobile/components/features/threads/ThreadsList.tsx): `apps/mobile/components/features/threads/ThreadsList.tsx`
- [Message Search](https://github.com/frappe/raven/blob/develop/raven/api/search.py): `raven/api/search.py`
- [Files and Media](https://github.com/frappe/raven/blob/develop/apps/mobile/components/features/media/Media.tsx): `apps/mobile/components/features/media/Media.tsx`
- [Link Previews](https://github.com/frappe/raven/blob/develop/raven/links.py): `raven/links.py`

### Frappe Messaging Core

- [Message Lifecycle](https://github.com/frappe/raven/blob/develop/raven/raven_messaging/doctype/raven_message/raven_message.py): `raven/raven_messaging/doctype/raven_message/raven_message.py`
- [Channel Management](https://github.com/frappe/raven/blob/develop/raven/raven_channel_management/doctype/raven_channel/raven_channel.py): `raven/raven_channel_management/doctype/raven_channel/raven_channel.py`
- [Realtime Events](https://github.com/frappe/raven/blob/develop/raven/realtime/handlers.py): `raven/realtime/handlers.py`
- [Notifications](https://github.com/frappe/raven/blob/develop/raven/notification.py): `raven/notification.py`

### AI and Integrations

- [AI Agents](https://github.com/frappe/raven/blob/develop/raven/ai/handler.py): `raven/ai/handler.py`
- [Frappe App Integration](https://github.com/frappe/raven/blob/develop/raven/raven_ai/doctype/raven_ai_function/raven_ai_function.py): `raven/raven_ai/doctype/raven_ai_function/raven_ai_function.py`
- [Webhooks](https://github.com/frappe/raven/blob/develop/raven/raven_integrations/doctype/raven_webhook/raven_webhook.py): `raven/raven_integrations/doctype/raven_webhook/raven_webhook.py`

### Other components

- **Team Member**

## Connections

- Team Member → Web App: uses (evidence: `README.md`)
- Team Member → Mobile App: uses (evidence: `README.md`)
- Web App → Channels and DMs: opens conversations
- Mobile App → Workspace Access: selects workspace
- Workspace Access → Channels and DMs: opens conversations
- Web App → Embedded Chat: offers embedded chat
- Team Member → Message Composer: writes messages (evidence: `README.md`)
- Message Composer → Message Lifecycle: sends message
- Message Lifecycle → Message Stream: updates conversation
- Team Member → Threads and Replies: replies in threads (evidence: `README.md`)
- Team Member → Message Search: searches messages (evidence: `README.md`)
- Team Member → Files and Media: shares files (evidence: `README.md`)
- Message Lifecycle → Link Previews: queues preview work (evidence: `raven/raven_messaging/doctype/raven_message/raven_message.py`)
- Message Lifecycle → Notifications: sends notifications (evidence: `raven/raven_messaging/doctype/raven_message/raven_message.py`)
- Message Lifecycle → AI Agents: handles AI messages
- Team Member → AI Agents: asks agent (evidence: `README.md`)
- AI Agents → Frappe App Integration: runs workflows (evidence: `README.md`)
- Team Member → Webhooks: configures integrations (evidence: `README.md`)
- Message Lifecycle → Realtime Events: publishes events
- Channel Management → Channels and DMs: organizes conversations
