# Rephrase — Native macOS Text-Rewriting Product

> Draft case study. Content to be expanded.

## Summary

Select text anywhere on macOS, press a global shortcut, and Rephrase captures the selection, streams a rewritten result from a backend, and pastes it back in place (with a copy fallback).

## Context and problem

Rewriting selected text in any application normally means copying it into a separate tool and pasting the result back by hand.

## My role and ownership

Personal project, designed and built end-to-end: native desktop app, backend API, auth, and data model.

## Technical implementation

### Architecture

- Native menu-bar app captures the selection (synthetic ⌘C, manual fallback)
- Backend streams a rewritten result; the app pastes it back (synthetic ⌘V, copy fallback)
- Server-owned prompt and presets; LLM access kept backend-only
- Single server-side `authorize()` seam; desktop holds no authorization logic
- Privacy default: do not persist input/output text, metadata only

### Stack

- Language: Swift (SwiftUI/AppKit), TypeScript
- Framework: Fastify (API), Next.js (web)
- Infrastructure: Fly.io, Supabase (PostgreSQL), Redis (rate limiting)
- Tooling: Turborepo + pnpm monorepo

## Key decisions and trade-offs

- Native auth via `ASWebAuthenticationSession` (Google OAuth, PKCE) — no custom URL scheme
- Paste-back is part of the v0 core loop, not deferred

## Outcome and evidence

v0 core loop working (capture → rewrite → paste-back), trial-gated. Billing (Stripe) deferred to v1.

## Links

- Repository: https://github.com/victorbillaud/rephrase
