# aris-code-0/mailroom architecture

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

- Interactive diagram: https://gitdiagram.com/aris-code-0/mailroom
- Repository: https://github.com/aris-code-0/mailroom

## Overview

Mailroom is a self-hosted email client: a user signs in to an Expo app, reads and manages mail, and composes messages; the app talks to a local Node backend that synchronizes with Resend and stores mail locally in SQLite. The backend also supports drafts, settings, domains, and attachment caching. The excerpts show the app’s API client, backend composition, persistence helpers, and provider calls; some feature links below rely on the README because their route implementations were not fully sampled.

Main entry points: [`App.tsx`](https://github.com/aris-code-0/mailroom/blob/main/App.tsx) (Mail workspace), [`server/app.mjs`](https://github.com/aris-code-0/mailroom/blob/main/server/app.mjs) (API and mail workflows), [`server/index.mjs`](https://github.com/aris-code-0/mailroom/blob/main/server/index.mjs) (Sync scheduler), [`src/api.ts`](https://github.com/aris-code-0/mailroom/blob/main/src/api.ts) (API client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Mail client"]
  node_app["Mail workspace<br/>[App.tsx]"]
  node_composer["Composer and settings<br/>[Composer.tsx]"]
  node_api_client["API client<br/>[api.ts]"]
  node_ui["UI components<br/>[ui.tsx]"]
  node_styles["UI styles<br/>[styles.ts]"]
end

subgraph group_service["Mail service"]
  node_routes["API and mail workflows<br/>[app.mjs]"]
  node_sync["Sync scheduler<br/>[index.mjs]"]
end

subgraph group_storage["Local data"]
  node_store["Mail store<br/>[store.mjs]"]
  node_sqlite[("SQLite database")]
end

subgraph group_integration["Email provider"]
  node_provider["Resend adapter<br/>[provider.mjs]"]
  node_resend["Resend API"]
end

node_user(("Mail user"))

node_user -->|"uses"| node_app
node_app -->|"requests"| node_api_client
node_app -.->|"opens"| node_composer
node_app -->|"renders"| node_ui
node_app -->|"styles with"| node_styles
node_composer -->|"saves and sends"| node_api_client
node_sync -->|"creates"| node_routes
node_sync -->|"creates"| node_store
node_sync -->|"creates"| node_provider
node_api_client -->|"calls API"| node_routes
node_routes -->|"reads and writes"| node_store
node_routes -->|"fetches and sends"| node_provider
node_store -->|"persists mail"| node_sqlite
node_provider -->|"calls"| node_resend
node_routes -.->|"authenticates"| node_user

click node_app "https://github.com/aris-code-0/mailroom/blob/main/App.tsx"
click node_composer "https://github.com/aris-code-0/mailroom/blob/main/src/Composer.tsx"
click node_api_client "https://github.com/aris-code-0/mailroom/blob/main/src/api.ts"
click node_ui "https://github.com/aris-code-0/mailroom/blob/main/src/ui.tsx"
click node_styles "https://github.com/aris-code-0/mailroom/blob/main/src/styles.ts"
click node_routes "https://github.com/aris-code-0/mailroom/blob/main/server/app.mjs"
click node_sync "https://github.com/aris-code-0/mailroom/blob/main/server/index.mjs"
click node_store "https://github.com/aris-code-0/mailroom/blob/main/server/store.mjs"
click node_provider "https://github.com/aris-code-0/mailroom/blob/main/server/provider.mjs"

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,node_composer,node_api_client,node_ui,node_styles,node_user toneBlue
class node_routes,node_sync toneAmber
class node_store,node_sqlite toneMint
class node_provider,node_resend toneRose
```

## Components

### Mail client

- [Mail workspace](https://github.com/aris-code-0/mailroom/blob/main/App.tsx): `App.tsx`
- [Composer and settings](https://github.com/aris-code-0/mailroom/blob/main/src/Composer.tsx): `src/Composer.tsx`
- [API client](https://github.com/aris-code-0/mailroom/blob/main/src/api.ts): `src/api.ts`
- [UI components](https://github.com/aris-code-0/mailroom/blob/main/src/ui.tsx): `src/ui.tsx`
- [UI styles](https://github.com/aris-code-0/mailroom/blob/main/src/styles.ts): `src/styles.ts`

### Mail service

- [API and mail workflows](https://github.com/aris-code-0/mailroom/blob/main/server/app.mjs): `server/app.mjs`
- [Sync scheduler](https://github.com/aris-code-0/mailroom/blob/main/server/index.mjs): `server/index.mjs`

### Local data

- [Mail store](https://github.com/aris-code-0/mailroom/blob/main/server/store.mjs): `server/store.mjs`
- **SQLite database**

### Email provider

- [Resend adapter](https://github.com/aris-code-0/mailroom/blob/main/server/provider.mjs): `server/provider.mjs`
- **Resend API**

### Other components

- **Mail user**

## Connections

- Mail user → Mail workspace: uses (evidence: `README.md`)
- Mail workspace → API client: requests (evidence: `App.tsx`)
- Mail workspace → Composer and settings: opens (evidence: `App.tsx`)
- Mail workspace → UI components: renders (evidence: `App.tsx`)
- Mail workspace → UI styles: styles with (evidence: `App.tsx`)
- Composer and settings → API client: saves and sends (evidence: `src/Composer.tsx`)
- Sync scheduler → API and mail workflows: creates (evidence: `server/index.mjs`)
- Sync scheduler → Mail store: creates (evidence: `server/index.mjs`)
- Sync scheduler → Resend adapter: creates (evidence: `server/index.mjs`)
- API client → API and mail workflows: calls API (evidence: `README.md`)
- API and mail workflows → Mail store: reads and writes (evidence: `server/app.mjs`)
- API and mail workflows → Resend adapter: fetches and sends (evidence: `server/app.mjs`)
- Mail store → SQLite database: persists mail (evidence: `README.md`)
- Resend adapter → Resend API: calls (evidence: `server/provider.mjs`)
- API and mail workflows → Mail user: authenticates
