# makdoom/transio architecture

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

- Interactive diagram: https://gitdiagram.com/makdoom/transio
- Repository: https://github.com/makdoom/transio

## Overview

Transio is an anonymous, browser-based encrypted file-sharing product. A sender selects a file; the client encrypts its bytes and metadata, asks the API to create a pending share, uploads the ciphertext directly to object storage, and completes the share. A recipient first views share status, then explicitly downloads and decrypts using the key in the URL fragment. The README documents QR sharing, expiry, and burn-on-download. Backend wiring is shown in the sampled routes and bootstrap; UI-to-client details beyond the app’s view selection are limited by the excerpts.

Main entry points: [`apps/web/src/lib/shares.ts`](https://github.com/makdoom/transio/blob/main/apps/web/src/lib/shares.ts) (Share workflow), [`apps/api/src/routes/shares.ts`](https://github.com/makdoom/transio/blob/main/apps/api/src/routes/shares.ts) (Share lifecycle), [`apps/api/src/index.ts`](https://github.com/makdoom/transio/blob/main/apps/api/src/index.ts) (API bootstrap), [`apps/web/src/App.tsx`](https://github.com/makdoom/transio/blob/main/apps/web/src/App.tsx) (Web app)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Browser sharing"]
  node_app["Web app<br/>[App.tsx]"]
  node_sender_view["Send share"]
  node_recipient_view["Receive share"]
  node_share_qr["Share QR<br/>[ShareQrCode.tsx]"]
  node_share_logic["Share workflow<br/>[shares.ts]"]
  node_crypto["Browser crypto<br/>[crypto.ts]"]
  node_transport["Share transport<br/>[share-transport.ts]"]
end

subgraph group_api["Share API"]
  node_api_boot["API bootstrap<br/>[index.ts]"]
  node_api_app["Fastify app<br/>[app.ts]"]
  node_share_routes["Share lifecycle<br/>[shares.ts]"]
end

subgraph group_state["Persistence and cleanup"]
  node_cleanup["Expiry cleanup<br/>[cleanup.ts]"]
  node_db_client["Database client<br/>[index.ts]"]
  node_share_schema[("Share records<br/>[schema.ts]")]
end

subgraph group_objects["Object storage"]
  node_storage_port["Storage port<br/>[storage-port.ts]"]
  node_r2_storage["R2 storage<br/>[r2-storage.ts]"]
end

node_sender(("Sender"))
node_recipient(("Recipient"))
node_r2[("Cloudflare R2")]

node_sender -->|"opens"| node_app
node_app -->|"selects send"| node_sender_view
node_app -->|"selects receive"| node_recipient_view
node_recipient -->|"opens link"| node_app
node_sender_view -.->|"creates share"| node_share_logic
node_recipient_view -.->|"downloads share"| node_share_logic
node_share_logic -->|"encrypts, decrypts"| node_crypto
node_share_logic -->|"requests lifecycle"| node_transport
node_share_logic -.->|"offers QR link"| node_share_qr
node_transport -->|"calls API"| node_share_routes
node_api_boot -->|"builds"| node_api_app
node_api_boot -->|"creates database"| node_db_client
node_api_boot -->|"runs sweep"| node_cleanup
node_api_boot -->|"configures storage"| node_r2_storage
node_api_app -->|"registers routes"| node_share_routes
node_share_routes -->|"reads, writes"| node_db_client
node_share_routes -->|"requests URLs"| node_storage_port
node_share_routes -->|"deletes expired blob"| node_cleanup
node_cleanup -->|"updates records"| node_db_client
node_cleanup -->|"deletes blobs"| node_storage_port
node_db_client -->|"uses schema"| node_share_schema
node_r2_storage -->|"implements"| node_storage_port
node_r2_storage -->|"signs object requests"| node_r2

click node_app "https://github.com/makdoom/transio/blob/main/apps/web/src/App.tsx"
click node_sender_view "https://github.com/makdoom/transio/blob/main/apps/web/src/components/SenderShareView.tsx"
click node_recipient_view "https://github.com/makdoom/transio/blob/main/apps/web/src/components/RecipientShareView.tsx"
click node_share_qr "https://github.com/makdoom/transio/blob/main/apps/web/src/components/ShareQrCode.tsx"
click node_share_logic "https://github.com/makdoom/transio/blob/main/apps/web/src/lib/shares.ts"
click node_crypto "https://github.com/makdoom/transio/blob/main/apps/web/src/lib/crypto.ts"
click node_transport "https://github.com/makdoom/transio/blob/main/apps/web/src/lib/share-transport.ts"
click node_api_boot "https://github.com/makdoom/transio/blob/main/apps/api/src/index.ts"
click node_api_app "https://github.com/makdoom/transio/blob/main/apps/api/src/app.ts"
click node_share_routes "https://github.com/makdoom/transio/blob/main/apps/api/src/routes/shares.ts"
click node_cleanup "https://github.com/makdoom/transio/blob/main/apps/api/src/shares/cleanup.ts"
click node_db_client "https://github.com/makdoom/transio/blob/main/apps/api/src/db/index.ts"
click node_share_schema "https://github.com/makdoom/transio/blob/main/apps/api/src/db/schema.ts"
click node_storage_port "https://github.com/makdoom/transio/blob/main/apps/api/src/storage/storage-port.ts"
click node_r2_storage "https://github.com/makdoom/transio/blob/main/apps/api/src/storage/r2-storage.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_app,node_sender_view,node_recipient_view,node_share_qr,node_share_logic,node_crypto,node_transport toneBlue
class node_api_boot,node_api_app,node_share_routes,node_r2 toneAmber
class node_cleanup,node_db_client,node_share_schema toneMint
class node_storage_port,node_r2_storage toneRose
class node_sender,node_recipient toneIndigo
```

## Components

### Browser sharing

- [Web app](https://github.com/makdoom/transio/blob/main/apps/web/src/App.tsx): `apps/web/src/App.tsx`
- [Send share](https://github.com/makdoom/transio/blob/main/apps/web/src/components/SenderShareView.tsx): `apps/web/src/components/SenderShareView.tsx`
- [Receive share](https://github.com/makdoom/transio/blob/main/apps/web/src/components/RecipientShareView.tsx): `apps/web/src/components/RecipientShareView.tsx`
- [Share QR](https://github.com/makdoom/transio/blob/main/apps/web/src/components/ShareQrCode.tsx): `apps/web/src/components/ShareQrCode.tsx`
- [Share workflow](https://github.com/makdoom/transio/blob/main/apps/web/src/lib/shares.ts): `apps/web/src/lib/shares.ts`
- [Browser crypto](https://github.com/makdoom/transio/blob/main/apps/web/src/lib/crypto.ts): `apps/web/src/lib/crypto.ts`
- [Share transport](https://github.com/makdoom/transio/blob/main/apps/web/src/lib/share-transport.ts): `apps/web/src/lib/share-transport.ts`

### Share API

- [API bootstrap](https://github.com/makdoom/transio/blob/main/apps/api/src/index.ts): `apps/api/src/index.ts`
- [Fastify app](https://github.com/makdoom/transio/blob/main/apps/api/src/app.ts): `apps/api/src/app.ts`
- [Share lifecycle](https://github.com/makdoom/transio/blob/main/apps/api/src/routes/shares.ts): `apps/api/src/routes/shares.ts`

### Persistence and cleanup

- [Expiry cleanup](https://github.com/makdoom/transio/blob/main/apps/api/src/shares/cleanup.ts): `apps/api/src/shares/cleanup.ts`
- [Database client](https://github.com/makdoom/transio/blob/main/apps/api/src/db/index.ts): `apps/api/src/db/index.ts`
- [Share records](https://github.com/makdoom/transio/blob/main/apps/api/src/db/schema.ts): `apps/api/src/db/schema.ts`

### Object storage

- [Storage port](https://github.com/makdoom/transio/blob/main/apps/api/src/storage/storage-port.ts): `apps/api/src/storage/storage-port.ts`
- [R2 storage](https://github.com/makdoom/transio/blob/main/apps/api/src/storage/r2-storage.ts): `apps/api/src/storage/r2-storage.ts`

### Other components

- **Sender**
- **Recipient**
- **Cloudflare R2**

## Connections

- Sender → Web app: opens (evidence: `README.md`)
- Web app → Send share: selects send (evidence: `apps/web/src/App.tsx`)
- Web app → Receive share: selects receive (evidence: `apps/web/src/App.tsx`)
- Recipient → Web app: opens link (evidence: `README.md`)
- Send share → Share workflow: creates share
- Receive share → Share workflow: downloads share
- Share workflow → Browser crypto: encrypts, decrypts (evidence: `apps/web/src/lib/shares.ts`)
- Share workflow → Share transport: requests lifecycle (evidence: `apps/web/src/lib/shares.ts`)
- Share workflow → Share QR: offers QR link
- Share transport → Share lifecycle: calls API (evidence: `README.md`)
- API bootstrap → Fastify app: builds (evidence: `apps/api/src/index.ts`)
- API bootstrap → Database client: creates database (evidence: `apps/api/src/index.ts`)
- API bootstrap → Expiry cleanup: runs sweep (evidence: `apps/api/src/index.ts`)
- API bootstrap → R2 storage: configures storage (evidence: `apps/api/src/index.ts`)
- Fastify app → Share lifecycle: registers routes (evidence: `apps/api/src/app.ts`)
- Share lifecycle → Database client: reads, writes (evidence: `apps/api/src/routes/shares.ts`)
- Share lifecycle → Storage port: requests URLs (evidence: `apps/api/src/routes/shares.ts`)
- Share lifecycle → Expiry cleanup: deletes expired blob (evidence: `apps/api/src/routes/shares.ts`)
- Expiry cleanup → Database client: updates records (evidence: `apps/api/src/shares/cleanup.ts`)
- Expiry cleanup → Storage port: deletes blobs (evidence: `apps/api/src/shares/cleanup.ts`)
- Database client → Share records: uses schema (evidence: `apps/api/src/db/index.ts`)
- R2 storage → Storage port: implements (evidence: `apps/api/src/storage/r2-storage.ts`)
- R2 storage → Cloudflare R2: signs object requests (evidence: `apps/api/src/storage/r2-storage.ts`)
