Retry Logic: Pub/Sub automatically retries failed messages with exponential backoff. Workers are designed to be idempotent, ensuring safe re-execution.
Error States: Failed processing updates Firestore status to failed with error details. Users can see error messages in the UI and retry if needed.
Monitoring: All workers log structured events with document IDs, user IDs, and processing metadata. Errors are logged with full context for debugging.
Logging: Structured logging using Google Cloud Logging with:
Monitoring: Cloud Functions provide built-in metrics:
Alerting: Can be configured for error rates, processing failures, or system health issues.
Serverless Scaling: Functions scale to zero during quiet periods, eliminating idle costs.
Summary-Only Storage: PDFs deleted after processing, only AI-generated summaries retained (no extracted text kept), reducing storage costs by 10-20x.
Efficient Queries: Firestore indexes optimized for common query patterns, reducing read costs.
Caching: Frontend uses static generation and CDN caching to minimize database reads.
Authentication: Firebase Authentication for user management, API keys for programmatic access.
Authorization: Document-level access control (users can only access their own documents or public documents).
Data Privacy: Original PDFs deleted after processing, only summaries retained (no extracted text from PDFs is kept).
API Security: API keys use hashed secrets, header-only authentication, time-limited expiration.
Anonymous: Can browse public documents only, no uploads.
Member (Registered): Can upload documents, access private collection, use MCP integration.
Premium (Upgraded): Same as Member, plus access to Premium quality processing (Gemini 2.5 Pro).
Admin: Full system access for moderation and management.
Public: Document summaries are visible to all users, enabling community discovery.
Private: Document summaries are visible only to the uploader.
Visibility Selection: Chosen at upload time, cannot be changed after upload (privacy and data integrity).
Assay's architecture demonstrates how event-driven, serverless design can create a scalable, maintainable, and user-friendly document intelligence system. By decoupling processing stages, enabling parallel execution, and providing real-time updates, we've built a system that scales automatically while delivering intelligent insights to users.
Future Enhancements:
The architecture continues to evolve as we add new capabilities, but the core principles—event-driven design, serverless execution, and real-time updates—remain the foundation for everything we build.
Explore Assay: assay.cirrusly-clever.com
ARTIFICIAL_INTELLIGENCE)ARTIFICIAL_INTELLIGENCE.AI_SAFETY)|A ∩ B| / |A ∪ B|, used for theme overlap calculation