Architecture

Overview

How Outdraft is layered from the client through API routes and background jobs to Supabase and email delivery.

What Outdraft is built around

Outdraft is a mail workspace that starts with a personal inbox, then reaches teams, organizations, and nests without changing the core product shape. This overview shows how the main layers fit together — from the client through API routes and background jobs to Supabase and email delivery — at a product level, not as an internal runbook.

Layers

Most product behavior crosses the same layers. Keeping a clear boundary between them is what lets compose, delivery, and inbound mail stay reliable as scopes grow.

  1. 01

    Client

    Next.js surfaces for marketing, the signed-in workspace, and this documentation. The browser talks to Outdraft through HTTP APIs and live updates — not by writing mail or membership rows itself.

  2. 02

    API routes

    Route Handlers validate the session (or system credentials), call the data layer, and enqueue background work. User-facing mail, nest, and project actions enter the system here.

  3. 03

    Background jobs

    A dedicated worker runs organization and team fanout, scheduled and personal delivery, mailbox cleanup, and related billing jobs. Queue data stays on private Redis in that environment — the browser never talks to it.

  4. 04

    Supabase

    Auth, Postgres, Storage, Realtime, and server routines hold durable state: messages, mailbox entries, organizations, teams, nests, and delivery progress.

  5. 05

    Email delivery

    External send and inbound mail. Outbound delivery and inbound events connect Outdraft inboxes to the wider email network.

How mail moves

Outbound mail is accepted through the API, stored, then delivered — including to external addresses when needed. Organization and team fanout, scheduled sends, and some personal delivery continue on the background worker rather than in the request that accepted the send. Inbound mail arrives from the outside network, is checked at the edge, and lands in the person's inbox. The client stays current through live updates instead of refreshing the whole workspace.

Scopes and identity

Mail and access are scoped as personal, team, or organization. Personal is the default path for one-to-one and external mail. Team and organization sends use a project-mail path, with an explicit From identity when sending as the organization. A nest is not a send scope — it is a place you bring existing mail into with people you invite. Per-user mailbox state — Inbox, Sent, Archive, Deleted, and read — stays with that person. The full boundary model is in Scopes.

Where auth sits

Browser sessions and system paths use different trust rules. Actions a person takes resolve their signed-in session first. Background jobs and inbound handling authenticate as system work — not with the browser session. Account and threat-model detail belongs in Security; here the important point is that trust boundaries change at that edge.

Read next

Continue with the rest of Architecture.