# osbytes/reelsaw architecture

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

- Interactive diagram: https://gitdiagram.com/osbytes/reelsaw
- Repository: https://github.com/osbytes/reelsaw

## Overview

Reelsaw is a self-hosted and hosted video-to-short-clips product. A user creates a project from a video link or upload, then background workers ingest and transcribe it, analyze and refine candidate moments, and render clips; the web app exposes the resulting project, transcript, and clip editor. The README also describes range-based clipping, reframing, captions, templates and asset libraries, integrations, and plan quotas. Arrows follow cited caller references or README workflow statements; several detailed pipeline internals were not sampled, so their links are documented rather than inferred.

Main entry points: [`apps/server/src/queue/workers.ts`](https://github.com/osbytes/reelsaw/blob/main/apps/server/src/queue/workers.ts) (Pipeline workers), [`apps/server/src/projects/service.ts`](https://github.com/osbytes/reelsaw/blob/main/apps/server/src/projects/service.ts) (Project service), [`apps/server/src/pipeline/ingest.ts`](https://github.com/osbytes/reelsaw/blob/main/apps/server/src/pipeline/ingest.ts) (Source ingest), [`apps/server/src/trpc/router.ts`](https://github.com/osbytes/reelsaw/blob/main/apps/server/src/trpc/router.ts) (tRPC API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["User experience"]
  node_web["Web workspace<br/>[App.tsx]"]
  node_api["tRPC API<br/>[router.ts]"]
  node_projects["Project service<br/>[service.ts]"]
  node_mcp["MCP interface<br/>[mcp.ts]"]
  node_zapier["Zapier integration<br/>[index.js]"]
end

subgraph group_workflow["Clip workflow"]
  node_ingest["Source ingest<br/>[ingest.ts]"]
  node_workers["Pipeline workers<br/>[workers.ts]"]
  node_common["Pipeline runtime<br/>[common.ts]"]
  node_transcribe["Transcription<br/>[transcribe.ts]"]
  node_analyze["Moment selection<br/>[analyze.ts]"]
  node_refine["Transcript refinement<br/>[refine.ts]"]
  node_render["Clip rendering<br/>[render.ts]"]
end

subgraph group_platform["Runtime platform"]
  node_queue["Job queues<br/>[boss.ts]"]
  node_database[("Project database<br/>[index.ts]")]
  node_uow["Transactional events<br/>[uow.ts]"]
  node_services["Service container<br/>[services.ts]"]
  node_storage["Media storage<br/>[index.ts]"]
end

subgraph group_capabilities["Product capabilities"]
  node_ai["AI providers<br/>[providers.ts]"]
  node_decisions["Decision history<br/>[service.ts]"]
  node_library["Asset library<br/>[service.ts]"]
  node_templates["Layer templates<br/>[templates.ts]"]
  node_quota["Usage quotas<br/>[quota.ts]"]
  node_webhooks["Webhook delivery<br/>[deliver.ts]"]
end

node_user(("Video creator"))

node_user -->|"submits video"| node_web
node_web -->|"calls API"| node_api
node_api -->|"routes project actions"| node_projects
node_projects -->|"starts ingest"| node_ingest
node_ingest -->|"enqueues jobs"| node_queue
node_queue -->|"dispatches jobs"| node_workers
node_workers -->|"runs stage"| node_transcribe
node_workers -->|"runs stage"| node_analyze
node_workers -->|"runs stage"| node_refine
node_workers -->|"runs stage"| node_render
node_workers -->|"uses runtime"| node_common
node_services -->|"configures providers"| node_ai
node_ingest -->|"reads and writes"| node_database
node_ingest -->|"stores source"| node_storage
node_projects -->|"schedules work"| node_queue
node_projects -->|"persists project state"| node_database
node_uow -->|"commits transactions"| node_database
node_uow -->|"enqueues atomically"| node_queue
node_uow -->|"writes deliveries"| node_webhooks
node_api -->|"serves library actions"| node_library
node_projects -->|"loads templates"| node_templates
node_api -->|"exposes decisions"| node_decisions
node_ingest -->|"checks source limits"| node_quota
node_mcp -->|"offers decision tools"| node_decisions
node_zapier -.->|"uses integration API"| node_api
node_transcribe -.->|"requests transcription"| node_ai
node_analyze -.->|"requests clip judgments"| node_ai
node_render -.->|"stores rendered clips"| node_storage

click node_web "https://github.com/osbytes/reelsaw/blob/main/apps/web/src/App.tsx"
click node_api "https://github.com/osbytes/reelsaw/blob/main/apps/server/src/trpc/router.ts"
click node_projects "https://github.com/osbytes/reelsaw/blob/main/apps/server/src/projects/service.ts"
click node_ingest "https://github.com/osbytes/reelsaw/blob/main/apps/server/src/pipeline/ingest.ts"
click node_queue "https://github.com/osbytes/reelsaw/blob/main/apps/server/src/queue/boss.ts"
click node_workers "https://github.com/osbytes/reelsaw/blob/main/apps/server/src/queue/workers.ts"
click node_common "https://github.com/osbytes/reelsaw/blob/main/apps/server/src/pipeline/common.ts"
click node_transcribe "https://github.com/osbytes/reelsaw/blob/main/apps/server/src/pipeline/transcribe.ts"
click node_analyze "https://github.com/osbytes/reelsaw/blob/main/apps/server/src/pipeline/analyze.ts"
click node_refine "https://github.com/osbytes/reelsaw/blob/main/apps/server/src/pipeline/refine.ts"
click node_render "https://github.com/osbytes/reelsaw/blob/main/apps/server/src/pipeline/render.ts"
click node_database "https://github.com/osbytes/reelsaw/blob/main/apps/server/src/db/index.ts"
click node_uow "https://github.com/osbytes/reelsaw/blob/main/apps/server/src/uow.ts"
click node_services "https://github.com/osbytes/reelsaw/blob/main/apps/server/src/services.ts"
click node_storage "https://github.com/osbytes/reelsaw/blob/main/apps/server/src/storage/index.ts"
click node_ai "https://github.com/osbytes/reelsaw/blob/main/apps/server/src/ai/providers.ts"
click node_decisions "https://github.com/osbytes/reelsaw/blob/main/apps/server/src/decisions/service.ts"
click node_library "https://github.com/osbytes/reelsaw/blob/main/apps/server/src/library/service.ts"
click node_templates "https://github.com/osbytes/reelsaw/blob/main/apps/server/src/library/templates.ts"
click node_quota "https://github.com/osbytes/reelsaw/blob/main/apps/server/src/quota.ts"
click node_webhooks "https://github.com/osbytes/reelsaw/blob/main/apps/server/src/webhooks/deliver.ts"
click node_mcp "https://github.com/osbytes/reelsaw/blob/main/apps/server/src/mcp.ts"
click node_zapier "https://github.com/osbytes/reelsaw/blob/main/integrations/zapier/index.js"

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_api,node_projects,node_mcp,node_zapier toneBlue
class node_ingest,node_workers,node_common,node_transcribe,node_analyze,node_refine,node_render toneAmber
class node_queue,node_database,node_uow,node_services,node_storage toneMint
class node_ai,node_decisions,node_library,node_templates,node_quota,node_webhooks toneRose
class node_user toneIndigo
```

## Components

### User experience

- [Web workspace](https://github.com/osbytes/reelsaw/blob/main/apps/web/src/App.tsx): `apps/web/src/App.tsx`
- [tRPC API](https://github.com/osbytes/reelsaw/blob/main/apps/server/src/trpc/router.ts): `apps/server/src/trpc/router.ts`
- [Project service](https://github.com/osbytes/reelsaw/blob/main/apps/server/src/projects/service.ts): `apps/server/src/projects/service.ts`
- [MCP interface](https://github.com/osbytes/reelsaw/blob/main/apps/server/src/mcp.ts): `apps/server/src/mcp.ts`
- [Zapier integration](https://github.com/osbytes/reelsaw/blob/main/integrations/zapier/index.js): `integrations/zapier/index.js`

### Clip workflow

- [Source ingest](https://github.com/osbytes/reelsaw/blob/main/apps/server/src/pipeline/ingest.ts): `apps/server/src/pipeline/ingest.ts`
- [Pipeline workers](https://github.com/osbytes/reelsaw/blob/main/apps/server/src/queue/workers.ts): `apps/server/src/queue/workers.ts`
- [Pipeline runtime](https://github.com/osbytes/reelsaw/blob/main/apps/server/src/pipeline/common.ts): `apps/server/src/pipeline/common.ts`
- [Transcription](https://github.com/osbytes/reelsaw/blob/main/apps/server/src/pipeline/transcribe.ts): `apps/server/src/pipeline/transcribe.ts`
- [Moment selection](https://github.com/osbytes/reelsaw/blob/main/apps/server/src/pipeline/analyze.ts): `apps/server/src/pipeline/analyze.ts`
- [Transcript refinement](https://github.com/osbytes/reelsaw/blob/main/apps/server/src/pipeline/refine.ts): `apps/server/src/pipeline/refine.ts`
- [Clip rendering](https://github.com/osbytes/reelsaw/blob/main/apps/server/src/pipeline/render.ts): `apps/server/src/pipeline/render.ts`

### Runtime platform

- [Job queues](https://github.com/osbytes/reelsaw/blob/main/apps/server/src/queue/boss.ts): `apps/server/src/queue/boss.ts`
- [Project database](https://github.com/osbytes/reelsaw/blob/main/apps/server/src/db/index.ts): `apps/server/src/db/index.ts`
- [Transactional events](https://github.com/osbytes/reelsaw/blob/main/apps/server/src/uow.ts): `apps/server/src/uow.ts`
- [Service container](https://github.com/osbytes/reelsaw/blob/main/apps/server/src/services.ts): `apps/server/src/services.ts`
- [Media storage](https://github.com/osbytes/reelsaw/blob/main/apps/server/src/storage/index.ts): `apps/server/src/storage/index.ts`

### Product capabilities

- [AI providers](https://github.com/osbytes/reelsaw/blob/main/apps/server/src/ai/providers.ts): `apps/server/src/ai/providers.ts`
- [Decision history](https://github.com/osbytes/reelsaw/blob/main/apps/server/src/decisions/service.ts): `apps/server/src/decisions/service.ts`
- [Asset library](https://github.com/osbytes/reelsaw/blob/main/apps/server/src/library/service.ts): `apps/server/src/library/service.ts`
- [Layer templates](https://github.com/osbytes/reelsaw/blob/main/apps/server/src/library/templates.ts): `apps/server/src/library/templates.ts`
- [Usage quotas](https://github.com/osbytes/reelsaw/blob/main/apps/server/src/quota.ts): `apps/server/src/quota.ts`
- [Webhook delivery](https://github.com/osbytes/reelsaw/blob/main/apps/server/src/webhooks/deliver.ts): `apps/server/src/webhooks/deliver.ts`

### Other components

- **Video creator**

## Connections

- Video creator → Web workspace: submits video
- Web workspace → tRPC API: calls API
- tRPC API → Project service: routes project actions (evidence: `apps/server/src/trpc/router.ts`)
- Project service → Source ingest: starts ingest (evidence: `apps/server/src/projects/service.ts`)
- Source ingest → Job queues: enqueues jobs (evidence: `apps/server/src/pipeline/ingest.ts`)
- Job queues → Pipeline workers: dispatches jobs (evidence: `apps/server/src/queue/workers.ts`)
- Pipeline workers → Transcription: runs stage (evidence: `apps/server/src/queue/workers.ts`)
- Pipeline workers → Moment selection: runs stage (evidence: `apps/server/src/queue/workers.ts`)
- Pipeline workers → Transcript refinement: runs stage (evidence: `apps/server/src/queue/workers.ts`)
- Pipeline workers → Clip rendering: runs stage (evidence: `apps/server/src/queue/workers.ts`)
- Pipeline workers → Pipeline runtime: uses runtime (evidence: `apps/server/src/queue/workers.ts`)
- Service container → AI providers: configures providers (evidence: `apps/server/src/services.ts`)
- Source ingest → Project database: reads and writes (evidence: `apps/server/src/pipeline/ingest.ts`)
- Source ingest → Media storage: stores source (evidence: `apps/server/src/pipeline/ingest.ts`)
- Project service → Job queues: schedules work (evidence: `apps/server/src/projects/service.ts`)
- Project service → Project database: persists project state (evidence: `apps/server/src/projects/service.ts`)
- Transactional events → Project database: commits transactions (evidence: `apps/server/src/uow.ts`)
- Transactional events → Job queues: enqueues atomically (evidence: `apps/server/src/uow.ts`)
- Transactional events → Webhook delivery: writes deliveries (evidence: `apps/server/src/uow.ts`)
- tRPC API → Asset library: serves library actions (evidence: `apps/server/src/trpc/router.ts`)
- Project service → Layer templates: loads templates (evidence: `apps/server/src/projects/service.ts`)
- tRPC API → Decision history: exposes decisions (evidence: `apps/server/src/trpc/router.ts`)
- Source ingest → Usage quotas: checks source limits (evidence: `apps/server/src/pipeline/ingest.ts`)
- MCP interface → Decision history: offers decision tools (evidence: `apps/server/src/decisions/service.ts`)
- Zapier integration → tRPC API: uses integration API
- Transcription → AI providers: requests transcription
- Moment selection → AI providers: requests clip judgments
- Clip rendering → Media storage: stores rendered clips
