diff --git a/README.md b/README.md index 9e70f9af..194024c7 100644 --- a/README.md +++ b/README.md @@ -122,3 +122,95 @@ npm run build --prefix backend npm run build --prefix frontend npm run lint --prefix frontend ``` + +--- + +## Deployment architecture (Origen Studio fork) + +> This section is specific to this fork and does not appear in upstream +> `willchen96/mike`. Edit-once / merge-clean: stays at the end of the file. + +We deploy Mike across three managed platforms today (Cloudflare, Railway, +Supabase), with a fourth (Fly.io) planned for the privacy gateway. + +### Status legend + +- โœ… **Live in production** +- ๐ŸŸก **Staging only** (production paused at the approval gate) +- ๐Ÿ”ต **Planned** (repo + config exist; not yet deployed) + +### Diagram + +``` + โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” + โ”‚ Browser (user) โ”‚ + โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ + โ”‚ HTTPS + โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” + โ”‚ Cloudflare Workers (global edge) ๐ŸŸก / โœ… โ”‚ + โ”‚ mike-frontend-staging โ”‚ + โ”‚ mike-frontend-production โ”‚ + โ”‚ Built by @opennextjs/cloudflare from Next 16 โ”‚ + โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ + โ”‚ HTTPS ยท NEXT_PUBLIC_API_BASE_URL + โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” + โ”‚ Railway ยท europe-west4 (Amsterdam) ๐ŸŸก / โœ… โ”‚ + โ”‚ mike-backend (Express, Nixpacks + LibreOffice) โ”‚ + โ””โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ + โ”‚ โ”‚ โ”‚ + โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ S3 SDK โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” + โ”‚ HTTPS โ”‚ โ”‚ HTTPS ๐Ÿ”ต + โ†“ โ†“ โ†“ +โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” +โ”‚ Supabase Cloud โ”‚ โ”‚ Cloudflare R2 โ”‚ โ”‚ Hey Jude (Fly.io ยท ams) โ”‚ +โ”‚ eu-west-1 โ”‚ โ”‚ EU jurisdiction โ”‚ โ”‚ mike-hey-jude โ”‚ +โ”‚ Auth + Postgres โ”‚ โ”‚ mike-staging โ”‚ โ”‚ (privacy proxy / PII) โ”‚ +โ”‚ mike-staging โ”‚ โ”‚ mike-prod โ”‚ โ”‚ OrigenStudio/hey-jude (priv)โ”‚ +โ”‚ mike-prod โ”‚ โ”‚ โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ +โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ + internal 6PN โ”‚ HTTPS ยท anonymized + โ”‚ prompts only + โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” + โ”‚ โ”‚ + โ†“ โ†“ + โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” + โ”‚ Ollama (Fly.io ยท ams) โ”‚ โ”‚ OpenAI API โ”‚ + โ”‚ qwen3:4b ยท A10 GPU โ”‚ โ”‚ (sees placeholders, โ”‚ + โ”‚ internal-only, no โ”‚ โ”‚ never raw PII) โ”‚ + โ”‚ public ingress โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ + โ”‚ OrigenStudio/ โ”‚ + โ”‚ mike-ollama (private) โ”‚ ๐Ÿ”ต + โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ +``` + +### Why this shape + +- **Cloudflare Workers** for the frontend โ†’ global edge CDN, scale-to-zero, + generous free tier. Configured by the repo (`@opennextjs/cloudflare`). +- **Railway** for the backend โ†’ long-running Express, LibreOffice subprocess + for DOC/DOCXโ†’PDF, 50 MB upload bodies. Needs a real container, not a + serverless function. Nixpacks installs LibreOffice automatically. +- **Supabase Cloud** for Auth + Postgres โ†’ the app is built around Supabase + Auth (`auth.uid()` RLS policies in `backend/schema.sql`); swapping it out + is a multi-day refactor (see DEPLOY.md ยง9 notes). +- **Cloudflare R2** for object storage โ†’ S3-compatible API, **zero egress**, + EU jurisdiction matches the rest of the stack. +- **Hey Jude + Ollama on Fly.io** (planned) โ†’ strips PII from prompts before + they leave our infrastructure. Local LLM (qwen3:4b on GPU) does the + context-aware detection; OpenAI never sees raw client data. + +### Related repositories + +- [`OrigenStudio/hey-jude`](https://github.com/OrigenStudio/hey-jude) โ€” private + fork of `sure-scale/hey-jude` with our Fly.io config. +- [`OrigenStudio/mike-ollama`](https://github.com/OrigenStudio/mike-ollama) โ€” + tiny Fly.io app running Ollama with `qwen3:4b`. +- [`willchen96/mike`](https://github.com/willchen96/mike) โ€” upstream of this + fork. A weekly Actions workflow checks for new commits and opens an issue. + +### Where to look next + +- **End-to-end deploy walkthrough**: [DEPLOY.md](DEPLOY.md) +- **CI/CD workflow**: [.github/workflows/ci-cd.yml](.github/workflows/ci-cd.yml) +- **Wrangler / Railway config**: [frontend/wrangler.jsonc](frontend/wrangler.jsonc), + [backend/railway.json](backend/railway.json), [backend/nixpacks.toml](backend/nixpacks.toml)