# charipramod/flare architecture

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

- Interactive diagram: https://gitdiagram.com/charipramod/flare
- Repository: https://github.com/charipramod/flare

## Overview

Flare is a self-hosted notification control plane. Users manage audiences, workflows, email, and operations through the dashboard or API; the API applies tenant and sending policies, while queued work is handled by workers and delivered through configured mail transports. The graph also preserves documented capabilities for inbound mail, automations, publication, and webhooks. Some subsystem links are documented in the README rather than shown in sampled source; unsampled implementation details are not inferred.

Main entry points: [`apps/api/src/main.ts`](https://github.com/charipramod/flare/blob/main/apps/api/src/main.ts) (Control API), [`packages/mail/src/pipeline.ts`](https://github.com/charipramod/flare/blob/main/packages/mail/src/pipeline.ts) (Mail pipeline), [`apps/worker/src/main.ts`](https://github.com/charipramod/flare/blob/main/apps/worker/src/main.ts) (Job workers), [`apps/api/src/mail.ts`](https://github.com/charipramod/flare/blob/main/apps/api/src/mail.ts) (Email API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["User interfaces"]
  node_dashboard["Dashboard<br/>[dashboard.tsx]"]
  node_webproxy["API proxy<br/>[route.ts]"]
  node_cli["CLI<br/>[main.ts]"]
  node_mcp["MCP server<br/>[server.ts]"]
end

subgraph group_control["Control plane"]
  node_api["Control API<br/>[main.ts]"]
  node_identity["Identity and access<br/>[identity.ts]"]
  node_audience["Audience management<br/>[audience.ts]"]
  node_workflows["Workflow management<br/>[workflows.ts]"]
  node_automations["Contact automations<br/>[automations.ts]"]
  node_publication["Content publication<br/>[publication.ts]"]
  node_operations["Operations and recovery<br/>[operations.ts]"]
end

subgraph group_messaging["Messaging"]
  node_inbound["Inbound mail<br/>[inbound.ts]"]
  node_mailapi["Email API<br/>[mail.ts]"]
  node_mailpipeline["Mail pipeline<br/>[pipeline.ts]"]
  node_routes["Transport routes<br/>[routes.ts]"]
  node_sendingpolicy["Sending policy<br/>[sending-policy.ts]"]
  node_smtp["SMTP relay<br/>[server.ts]"]
end

subgraph group_execution["Background execution"]
  node_worker["Job workers<br/>[main.ts]"]
  node_mailworker["Mail worker<br/>[mail.ts]"]
  node_webhookworker["Webhook worker<br/>[webhooks.ts]"]
end

subgraph group_foundation["Shared services"]
  node_db[("PostgreSQL<br/>[schema.ts]")]
  node_shared["Shared contracts<br/>[workflows.ts]"]
  node_redis["Redis queues"]
end

node_user(("User or operator"))
node_transport["Mail transport"]
node_novu["Novu service"]

node_user -->|"uses"| node_dashboard
node_dashboard -.->|"requests"| node_webproxy
node_webproxy -.->|"proxies requests"| node_api
node_user -.->|"uses"| node_cli
node_cli -.->|"calls API"| node_api
node_mcp -.->|"calls API"| node_api
node_api -->|"registers controller"| node_identity
node_api -->|"registers controller"| node_audience
node_api -->|"registers controller"| node_workflows
node_api -->|"registers controller"| node_automations
node_api -->|"registers controller"| node_publication
node_api -->|"registers controller"| node_operations
node_api -->|"registers controller"| node_inbound
node_api -->|"registers controller"| node_mailapi
node_api -->|"queries"| node_db
node_api -->|"connects"| node_redis
node_api -->|"uses contracts"| node_shared
node_mailapi -.->|"submits mail"| node_mailpipeline
node_mailpipeline -->|"checks policy"| node_sendingpolicy
node_mailpipeline -->|"resolves route"| node_routes
node_mailpipeline -.->|"writes message data"| node_db
node_mailpipeline -.->|"delivers through"| node_transport
node_smtp -.->|"submits message"| node_mailapi
node_worker -->|"starts worker"| node_mailworker
node_worker -->|"starts worker"| node_webhookworker
node_worker -->|"connects"| node_redis
node_mailworker -.->|"delivers mail"| node_transport
node_webhookworker -->|"reads deliveries"| node_db
node_workflows -.->|"integrates"| node_novu

click node_dashboard "https://github.com/charipramod/flare/blob/main/apps/web/components/dashboard.tsx"
click node_webproxy "https://github.com/charipramod/flare/blob/main/apps/web/app/api/%5B...path%5D/route.ts"
click node_cli "https://github.com/charipramod/flare/blob/main/apps/cli/src/main.ts"
click node_mcp "https://github.com/charipramod/flare/blob/main/apps/mcp/src/server.ts"
click node_api "https://github.com/charipramod/flare/blob/main/apps/api/src/main.ts"
click node_identity "https://github.com/charipramod/flare/blob/main/apps/api/src/identity.ts"
click node_audience "https://github.com/charipramod/flare/blob/main/apps/api/src/audience.ts"
click node_workflows "https://github.com/charipramod/flare/blob/main/apps/api/src/workflows.ts"
click node_automations "https://github.com/charipramod/flare/blob/main/apps/api/src/automations.ts"
click node_publication "https://github.com/charipramod/flare/blob/main/apps/api/src/publication.ts"
click node_operations "https://github.com/charipramod/flare/blob/main/apps/api/src/operations.ts"
click node_inbound "https://github.com/charipramod/flare/blob/main/apps/api/src/inbound.ts"
click node_mailapi "https://github.com/charipramod/flare/blob/main/apps/api/src/mail.ts"
click node_mailpipeline "https://github.com/charipramod/flare/blob/main/packages/mail/src/pipeline.ts"
click node_routes "https://github.com/charipramod/flare/blob/main/packages/mail/src/routes.ts"
click node_sendingpolicy "https://github.com/charipramod/flare/blob/main/packages/mail/src/sending-policy.ts"
click node_smtp "https://github.com/charipramod/flare/blob/main/apps/smtp-relay/src/server.ts"
click node_worker "https://github.com/charipramod/flare/blob/main/apps/worker/src/main.ts"
click node_mailworker "https://github.com/charipramod/flare/blob/main/apps/worker/src/mail.ts"
click node_webhookworker "https://github.com/charipramod/flare/blob/main/apps/worker/src/webhooks.ts"
click node_db "https://github.com/charipramod/flare/blob/main/packages/db/src/schema.ts"
click node_shared "https://github.com/charipramod/flare/blob/main/packages/shared/src/workflows.ts"

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_dashboard,node_webproxy,node_cli,node_mcp,node_user toneBlue
class node_api,node_identity,node_audience,node_workflows,node_automations,node_publication,node_operations toneAmber
class node_inbound,node_mailapi,node_mailpipeline,node_routes,node_sendingpolicy,node_smtp toneMint
class node_worker,node_mailworker,node_webhookworker toneRose
class node_db,node_shared,node_redis,node_transport,node_novu toneIndigo
```

## Components

### User interfaces

- [Dashboard](https://github.com/charipramod/flare/blob/main/apps/web/components/dashboard.tsx): `apps/web/components/dashboard.tsx`
- [API proxy](https://github.com/charipramod/flare/blob/main/apps/web/app/api/%5B...path%5D/route.ts): `apps/web/app/api/[...path]/route.ts`
- [CLI](https://github.com/charipramod/flare/blob/main/apps/cli/src/main.ts): `apps/cli/src/main.ts`
- [MCP server](https://github.com/charipramod/flare/blob/main/apps/mcp/src/server.ts): `apps/mcp/src/server.ts`

### Control plane

- [Control API](https://github.com/charipramod/flare/blob/main/apps/api/src/main.ts): `apps/api/src/main.ts`
- [Identity and access](https://github.com/charipramod/flare/blob/main/apps/api/src/identity.ts): `apps/api/src/identity.ts`
- [Audience management](https://github.com/charipramod/flare/blob/main/apps/api/src/audience.ts): `apps/api/src/audience.ts`
- [Workflow management](https://github.com/charipramod/flare/blob/main/apps/api/src/workflows.ts): `apps/api/src/workflows.ts`
- [Contact automations](https://github.com/charipramod/flare/blob/main/apps/api/src/automations.ts): `apps/api/src/automations.ts`
- [Content publication](https://github.com/charipramod/flare/blob/main/apps/api/src/publication.ts): `apps/api/src/publication.ts`
- [Operations and recovery](https://github.com/charipramod/flare/blob/main/apps/api/src/operations.ts): `apps/api/src/operations.ts`

### Messaging

- [Inbound mail](https://github.com/charipramod/flare/blob/main/apps/api/src/inbound.ts): `apps/api/src/inbound.ts`
- [Email API](https://github.com/charipramod/flare/blob/main/apps/api/src/mail.ts): `apps/api/src/mail.ts`
- [Mail pipeline](https://github.com/charipramod/flare/blob/main/packages/mail/src/pipeline.ts): `packages/mail/src/pipeline.ts`
- [Transport routes](https://github.com/charipramod/flare/blob/main/packages/mail/src/routes.ts): `packages/mail/src/routes.ts`
- [Sending policy](https://github.com/charipramod/flare/blob/main/packages/mail/src/sending-policy.ts): `packages/mail/src/sending-policy.ts`
- [SMTP relay](https://github.com/charipramod/flare/blob/main/apps/smtp-relay/src/server.ts): `apps/smtp-relay/src/server.ts`

### Background execution

- [Job workers](https://github.com/charipramod/flare/blob/main/apps/worker/src/main.ts): `apps/worker/src/main.ts`
- [Mail worker](https://github.com/charipramod/flare/blob/main/apps/worker/src/mail.ts): `apps/worker/src/mail.ts`
- [Webhook worker](https://github.com/charipramod/flare/blob/main/apps/worker/src/webhooks.ts): `apps/worker/src/webhooks.ts`

### Shared services

- [PostgreSQL](https://github.com/charipramod/flare/blob/main/packages/db/src/schema.ts): `packages/db/src/schema.ts`
- [Shared contracts](https://github.com/charipramod/flare/blob/main/packages/shared/src/workflows.ts): `packages/shared/src/workflows.ts`
- **Redis queues**

### Other components

- **User or operator**
- **Mail transport**
- **Novu service**

## Connections

- User or operator → Dashboard: uses (evidence: `README.md`)
- Dashboard → API proxy: requests
- API proxy → Control API: proxies requests
- User or operator → CLI: uses
- CLI → Control API: calls API
- MCP server → Control API: calls API
- Control API → Identity and access: registers controller (evidence: `apps/api/src/main.ts`)
- Control API → Audience management: registers controller (evidence: `apps/api/src/main.ts`)
- Control API → Workflow management: registers controller (evidence: `apps/api/src/main.ts`)
- Control API → Contact automations: registers controller (evidence: `apps/api/src/main.ts`)
- Control API → Content publication: registers controller (evidence: `apps/api/src/main.ts`)
- Control API → Operations and recovery: registers controller (evidence: `apps/api/src/main.ts`)
- Control API → Inbound mail: registers controller (evidence: `apps/api/src/main.ts`)
- Control API → Email API: registers controller (evidence: `apps/api/src/main.ts`)
- Control API → PostgreSQL: queries
- Control API → Redis queues: connects
- Control API → Shared contracts: uses contracts
- Email API → Mail pipeline: submits mail
- Mail pipeline → Sending policy: checks policy (evidence: `packages/mail/src/pipeline.ts`)
- Mail pipeline → Transport routes: resolves route (evidence: `packages/mail/src/pipeline.ts`)
- Mail pipeline → PostgreSQL: writes message data
- Mail pipeline → Mail transport: delivers through
- SMTP relay → Email API: submits message
- Job workers → Mail worker: starts worker (evidence: `apps/worker/src/main.ts`)
- Job workers → Webhook worker: starts worker (evidence: `apps/worker/src/main.ts`)
- Job workers → Redis queues: connects (evidence: `apps/worker/src/main.ts`)
- Mail worker → Mail transport: delivers mail
- Webhook worker → PostgreSQL: reads deliveries (evidence: `apps/worker/src/webhooks.ts`)
- Workflow management → Novu service: integrates
