# ankush0286/mireva architecture

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

- Interactive diagram: https://gitdiagram.com/ankush0286/mireva
- Repository: https://github.com/ankush0286/mireva

## Overview

Mireva is a self-hosted marketing automation platform combining an interactive AI copilot, a persistent autonomous strategist, social CRM workflows, and browser-based social execution. The main user path runs from the React workspace through the FastAPI API to domain services and the copilot agent; the strategist also invokes that agent on scheduled cycles. The README documents shared PostgreSQL-backed state and a Go browser bridge. Some domain modules and bridge wiring are unsampled, so those capabilities are shown without asserting unverified call chains.

Main entry points: [`backend/src/app/api/v1/router.py`](https://github.com/ankush0286/mireva/blob/master/backend/src/app/api/v1/router.py) (API v1 routes), [`backend/src/app/main.py`](https://github.com/ankush0286/mireva/blob/master/backend/src/app/main.py) (FastAPI application), [`backend/src/app/agent/loop.py`](https://github.com/ankush0286/mireva/blob/master/backend/src/app/agent/loop.py) (Copilot agent loop), [`frontend/src/App.tsx`](https://github.com/ankush0286/mireva/blob/master/frontend/src/App.tsx) (Workspace UI)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workspace["Operator workspace"]
  node_webapp["Workspace UI<br/>[App.tsx]"]
  node_api_client["API client<br/>[client.ts]"]
  node_copilot_ui["Chat workspace<br/>[ChatPage.tsx]"]
  node_mission_ui["Mission control"]
end

subgraph group_backend["API and AI workflows"]
  node_api["FastAPI application<br/>[main.py]"]
  node_api_router["API v1 routes<br/>[router.py]"]
  node_agent_loop["Copilot agent loop<br/>[loop.py]"]
  node_copilot_service["Copilot sessions<br/>[service.py]"]
  node_strategist_worker["Strategist cycle worker"]
  node_scheduler["Background scheduler<br/>[scheduler.py]"]
end

subgraph group_growth["Marketing operations"]
  node_crm["Accounts and CRM<br/>[service.py]"]
  node_campaigns["Campaign management<br/>[service.py]"]
  node_outreach["Outreach management<br/>[service.py]"]
  node_triggers["Social triggers<br/>[service.py]"]
  node_connectors["Marketing connectors<br/>[service.py]"]
  node_brand["Brand kit<br/>[service.py]"]
  node_history["Activity history<br/>[service.py]"]
end

subgraph group_execution["Browser execution"]
  node_browser_agent["Browser sub-agent<br/>[browser_agent.py]"]
  node_platforms["Social platform adapters<br/>[registry.py]"]
  node_browser_bridge["Browser bridge<br/>[main.go]"]
end

node_operator(("Marketing operator"))
node_database[("PostgreSQL")]

node_operator -->|"uses"| node_webapp
node_webapp -->|"routes to"| node_copilot_ui
node_webapp -->|"routes to"| node_mission_ui
node_copilot_ui -.->|"requests"| node_api_client
node_mission_ui -.->|"requests"| node_api_client
node_api_client -->|"calls API"| node_api
node_api -->|"mounts routes"| node_api_router
node_api -->|"starts"| node_scheduler
node_api_router -->|"serves sessions"| node_copilot_service
node_api_router -->|"streams turns"| node_agent_loop
node_agent_loop -->|"uses session state"| node_copilot_service
node_scheduler -->|"schedules"| node_strategist_worker
node_strategist_worker -->|"runs cycle"| node_agent_loop
node_api_router -.->|"serves CRM"| node_crm
node_api_router -.->|"serves campaigns"| node_campaigns
node_api_router -.->|"serves outreach"| node_outreach
node_api_router -.->|"serves triggers"| node_triggers
node_api_router -.->|"serves connectors"| node_connectors
node_api_router -.->|"serves brand kit"| node_brand
node_api_router -.->|"serves history"| node_history
node_agent_loop -.->|"invokes exploration"| node_browser_agent
node_browser_agent -.->|"uses adapters"| node_platforms
node_browser_agent -.->|"shares browser sessions"| node_browser_bridge
node_api -.->|"persists state"| node_database
node_strategist_worker -->|"reads review outcomes"| node_database
node_operator -->|"reviews and controls"| node_mission_ui

click node_webapp "https://github.com/ankush0286/mireva/blob/master/frontend/src/App.tsx"
click node_api_client "https://github.com/ankush0286/mireva/blob/master/frontend/src/api/client.ts"
click node_copilot_ui "https://github.com/ankush0286/mireva/blob/master/frontend/src/features/chat/ChatPage.tsx"
click node_mission_ui "https://github.com/ankush0286/mireva/blob/master/frontend/src/features/mission_control/MissionControlPage.tsx"
click node_api "https://github.com/ankush0286/mireva/blob/master/backend/src/app/main.py"
click node_api_router "https://github.com/ankush0286/mireva/blob/master/backend/src/app/api/v1/router.py"
click node_agent_loop "https://github.com/ankush0286/mireva/blob/master/backend/src/app/agent/loop.py"
click node_copilot_service "https://github.com/ankush0286/mireva/blob/master/backend/src/app/modules/copilot/service.py"
click node_strategist_worker "https://github.com/ankush0286/mireva/blob/master/backend/src/app/automation/workers/strategist_worker.py"
click node_scheduler "https://github.com/ankush0286/mireva/blob/master/backend/src/app/automation/scheduler.py"
click node_crm "https://github.com/ankush0286/mireva/blob/master/backend/src/app/modules/accounts/service.py"
click node_campaigns "https://github.com/ankush0286/mireva/blob/master/backend/src/app/modules/campaigns/service.py"
click node_outreach "https://github.com/ankush0286/mireva/blob/master/backend/src/app/modules/outreach/service.py"
click node_triggers "https://github.com/ankush0286/mireva/blob/master/backend/src/app/modules/triggers/service.py"
click node_connectors "https://github.com/ankush0286/mireva/blob/master/backend/src/app/modules/connectors/service.py"
click node_brand "https://github.com/ankush0286/mireva/blob/master/backend/src/app/modules/brand/service.py"
click node_history "https://github.com/ankush0286/mireva/blob/master/backend/src/app/modules/history/service.py"
click node_browser_agent "https://github.com/ankush0286/mireva/blob/master/backend/src/app/agent/browser_agent.py"
click node_platforms "https://github.com/ankush0286/mireva/blob/master/backend/src/app/platforms/registry.py"
click node_browser_bridge "https://github.com/ankush0286/mireva/blob/master/services/browser-bridge/cmd/server/main.go"

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_webapp,node_api_client,node_copilot_ui,node_mission_ui toneBlue
class node_api,node_api_router,node_agent_loop,node_copilot_service,node_strategist_worker,node_scheduler,node_database toneAmber
class node_crm,node_campaigns,node_outreach,node_triggers,node_connectors,node_brand,node_history toneMint
class node_browser_agent,node_platforms,node_browser_bridge toneRose
class node_operator toneIndigo
```

## Components

### Operator workspace

- [Workspace UI](https://github.com/ankush0286/mireva/blob/master/frontend/src/App.tsx): `frontend/src/App.tsx`
- [API client](https://github.com/ankush0286/mireva/blob/master/frontend/src/api/client.ts): `frontend/src/api/client.ts`
- [Chat workspace](https://github.com/ankush0286/mireva/blob/master/frontend/src/features/chat/ChatPage.tsx): `frontend/src/features/chat/ChatPage.tsx`
- [Mission control](https://github.com/ankush0286/mireva/blob/master/frontend/src/features/mission_control/MissionControlPage.tsx): `frontend/src/features/mission_control/MissionControlPage.tsx`

### API and AI workflows

- [FastAPI application](https://github.com/ankush0286/mireva/blob/master/backend/src/app/main.py): `backend/src/app/main.py`
- [API v1 routes](https://github.com/ankush0286/mireva/blob/master/backend/src/app/api/v1/router.py): `backend/src/app/api/v1/router.py`
- [Copilot agent loop](https://github.com/ankush0286/mireva/blob/master/backend/src/app/agent/loop.py): `backend/src/app/agent/loop.py`
- [Copilot sessions](https://github.com/ankush0286/mireva/blob/master/backend/src/app/modules/copilot/service.py): `backend/src/app/modules/copilot/service.py`
- [Strategist cycle worker](https://github.com/ankush0286/mireva/blob/master/backend/src/app/automation/workers/strategist_worker.py): `backend/src/app/automation/workers/strategist_worker.py`
- [Background scheduler](https://github.com/ankush0286/mireva/blob/master/backend/src/app/automation/scheduler.py): `backend/src/app/automation/scheduler.py`

### Marketing operations

- [Accounts and CRM](https://github.com/ankush0286/mireva/blob/master/backend/src/app/modules/accounts/service.py): `backend/src/app/modules/accounts/service.py`
- [Campaign management](https://github.com/ankush0286/mireva/blob/master/backend/src/app/modules/campaigns/service.py): `backend/src/app/modules/campaigns/service.py`
- [Outreach management](https://github.com/ankush0286/mireva/blob/master/backend/src/app/modules/outreach/service.py): `backend/src/app/modules/outreach/service.py`
- [Social triggers](https://github.com/ankush0286/mireva/blob/master/backend/src/app/modules/triggers/service.py): `backend/src/app/modules/triggers/service.py`
- [Marketing connectors](https://github.com/ankush0286/mireva/blob/master/backend/src/app/modules/connectors/service.py): `backend/src/app/modules/connectors/service.py`
- [Brand kit](https://github.com/ankush0286/mireva/blob/master/backend/src/app/modules/brand/service.py): `backend/src/app/modules/brand/service.py`
- [Activity history](https://github.com/ankush0286/mireva/blob/master/backend/src/app/modules/history/service.py): `backend/src/app/modules/history/service.py`

### Browser execution

- [Browser sub-agent](https://github.com/ankush0286/mireva/blob/master/backend/src/app/agent/browser_agent.py): `backend/src/app/agent/browser_agent.py`
- [Social platform adapters](https://github.com/ankush0286/mireva/blob/master/backend/src/app/platforms/registry.py): `backend/src/app/platforms/registry.py`
- [Browser bridge](https://github.com/ankush0286/mireva/blob/master/services/browser-bridge/cmd/server/main.go): `services/browser-bridge/cmd/server/main.go`

### Other components

- **Marketing operator**
- **PostgreSQL**

## Connections

- Marketing operator → Workspace UI: uses
- Workspace UI → Chat workspace: routes to (evidence: `frontend/src/App.tsx`)
- Workspace UI → Mission control: routes to (evidence: `frontend/src/App.tsx`)
- Chat workspace → API client: requests
- Mission control → API client: requests
- API client → FastAPI application: calls API (evidence: `frontend/src/api/client.ts`)
- FastAPI application → API v1 routes: mounts routes (evidence: `backend/src/app/main.py`)
- FastAPI application → Background scheduler: starts (evidence: `backend/src/app/main.py`)
- API v1 routes → Copilot sessions: serves sessions
- API v1 routes → Copilot agent loop: streams turns
- Copilot agent loop → Copilot sessions: uses session state (evidence: `backend/src/app/agent/loop.py`)
- Background scheduler → Strategist cycle worker: schedules (evidence: `backend/src/app/automation/scheduler.py`)
- Strategist cycle worker → Copilot agent loop: runs cycle (evidence: `backend/src/app/automation/workers/strategist_worker.py`)
- API v1 routes → Accounts and CRM: serves CRM
- API v1 routes → Campaign management: serves campaigns
- API v1 routes → Outreach management: serves outreach
- API v1 routes → Social triggers: serves triggers
- API v1 routes → Marketing connectors: serves connectors
- API v1 routes → Brand kit: serves brand kit
- API v1 routes → Activity history: serves history
- Copilot agent loop → Browser sub-agent: invokes exploration
- Browser sub-agent → Social platform adapters: uses adapters
- Browser sub-agent → Browser bridge: shares browser sessions
- FastAPI application → PostgreSQL: persists state
- Strategist cycle worker → PostgreSQL: reads review outcomes (evidence: `backend/src/app/automation/workers/strategist_worker.py`)
- Marketing operator → Mission control: reviews and controls
