Assay transforms document processing through an event-driven, serverless architecture that scales automatically, processes documents asynchronously, and delivers intelligent summaries in real-time. Beyond the web interface, Assay provides programmatic access through MCP (Model Context Protocol) and CLI/API interfaces, enabling users to interact directly with the document substrate for deeper analysis, synthesis, and custom workflows. This document outlines the architectural decisions and design patterns that make Assay both powerful and scalable.
Assay is built on a foundation of event-driven, serverless architecture using Google Cloud Platform. This design choice addresses the core challenges of document processing at scale: unpredictable workloads, the need for parallel processing, and the requirement for real-time user feedback. The architecture also supports programmatic access through MCP (Model Context Protocol) and CLI/API interfaces, allowing users to treat Assay as a document substrate for custom analysis, synthesis, and integration into larger workflows.
At its core, Assay follows a simple but powerful pattern: upload triggers processing, processing publishes events, events trigger workers, workers update state, state updates appear in real-time.
┌─────────────────────────────────────────────────────────────────┐ │ ASSAY SYSTEM │ │ │ │ ┌──────────────┐ ┌──────────────┐ │ │ │ Frontend │────────▶│ Cloud Storage│ │ │ │ (Next.js) │ Upload │ (PDFs) │ │ │ └──────────────┘ └──────┬───────┘ │ │ │ │ │ │ │ │ Storage Trigger │ │ │ │ (onFileUpload) │ │ │ ▼ │ │ │ ┌─────────────────┐ │ │ │ │ Upload Trigger │ │ │ │ │ (Entry Point) │ │ │ │ └────────┬────────┘ │ │ │ │ │ │ │ │ Pub/Sub Topics │ │ │ │ (Event Bus) │ │ │ ▼ │ │ │ ┌─────────────────┐ │ │ │ │ Pub/Sub Topics │ │ │ │ │ (Message Queue) │ │ │ │ └────────┬────────┘ │ │ │ │ │ │ │ ┌─────────┴─────────┐ │ │ │ │ │ │ │ │ ┌──────▼──────┐ ┌──────▼──────┐ │ │ │ │ Workers │ │ Workers │ │ │ │ │ (Parallel │ │ (Parallel │ │ │ │ │ Processing) │ │ Processing) │ │ │ │ └──────┬──────┘ └──────┬──────┘ │ │ │ │ │ │ │ │ └─────────┬─────────┘ │ │ │ │ │ │ │ ▼ │ │ │ ┌─────────────────┐ │ │ │ │ Firestore │ │ │ │ │ (Document State│ │ │ │ │ & Summaries) │ │ │ │ └─────────────────┘ │ │ │ │ │ │ │ │ Real-time Listeners │ │ │ │ (onSnapshot) │ │ │ ▼ │ │ │ ┌─────────────────┐ │ │ │ │ Frontend UI │ │ │ │ │ (Live Updates) │ │ │ │ └─────────────────┘ │ └─────────┴─────────────────────────────────────────────────────┘
Frontend (Next.js)
Cloud Storage
uploads/{userId}/{documentId}/original.pdfStorage Trigger (`onFileUpload`)
pdf-uploaded Pub/Sub topicPub/Sub Topics (Event Bus)
pdf-uploaded - Triggers text extractionpdf-text-extracted - Triggers parallel metadata and signals extractionpdf-metadata-extracted - Metadata extraction completepdf-signals-extracted - Triggers theme matching and strategy selectionpdf-themes-match-requested - Triggers canonical theme matchingpdf-themes-matched - Triggers FAQ generationpdf-strategy-selected - Triggers summary generationpdf-summary-requested - Triggers single-pass or hierarchical summarizationpdf-faq-summary-requested - Triggers FAQ generationpdf-summary-completed - Processing completepdf-processing-failed - Error trackingWorker Functions (Cloud Functions)
Firestore Database
processing/ collection - Processing state and raw datadisplay/ collection - UI-optimized display data