Hybrid Edge Architecture
Relevant source files
The following files were used as context for generating this wiki page:
The Hybrid Edge Architecture, codenamed the Hybrid Edge Symphony, is the core infrastructure model of the hex-yt-intel project. It is designed to transcend standard serverless execution limits by utilizing a multi-cloud hybrid flow that distributes responsibilities across Vercel and Cloudflare. This architecture ensures high-security authentication, persistent data integrity, and high-performance streaming for complex LLM synthesis tasks.
The primary goal of this architecture is to support the Deep UCIS v5.1 analysis framework with zero timeouts, zero exposed database keys, and 100% reliability. It manages the transition from short-lived serverless functions to high-latency edge streaming, enabling the platform to process long-form YouTube content into structured intelligence databases.
Sources: README.md:16-24, CLAUDE.md:14-19
Core Infrastructure Components
The architecture is built on three primary pillars that coordinate the lifecycle of a content analysis request.
The Component Stack
| Component | Provider | Role | Timing / Horizon |
|---|---|---|---|
| Vercel Bouncer | Vercel | High-security authentication and atomic quota enforcement. | ~8 seconds |
| Cloudflare Streamer | Cloudflare | Direct browser-to-edge SSE connection for high-latency LLM synthesis. | ~58 seconds |
| HMAC Persistence | S2S | Cryptographically signed server-to-server database writes for data integrity. | Background |
Sources: README.md:17-21, CLAUDE.md:14-19
Multi-Cloud Lifecycle
The system utilizes a stratified approach to handle different stages of the request. Vercel acts as the initial gatekeeper ("Bouncer") for authentication and quota checks, while Cloudflare handles the intensive computational task of LLM synthesis through its edge workers.
The diagram shows the transition from Vercel-based authentication to Cloudflare-based LLM streaming and final persistence.
Sources: README.md:17-21, CLAUDE.md:14-19
Architectural Laws and Protocols
The Hybrid Edge Symphony is governed by a set of strict architectural laws to maintain performance and cost-efficiency.
Cache and Timeout Management
- Law #1: Pre-Query Cache Hit Circuit: Before initiating any new analysis, the system must query the Supabase
analysestable matching thevideo_idanduser_id. If a result exists, it is returned immediately to save video tokens and provide $0 cost queries. - Law #2: Stratified Dual-Timeouts: The system uses specific timeout horizons to detect network faults and manage execution. Vercel is limited to a 25-second token streaming window, while Cloudflare Workers support up to a 90-second maximum read.
- Law #3: Streaming Response Execution: All analytical route handlers implement dynamic response streaming (Server-Sent Events) to extend the connection lifetime beyond standard serverless limits.
Sources: CLAUDE.md:5-12, GEMINI.md:46-60
Security and Persistence
The architecture implements a S2S /persist flow. This involves tamper-proof server-to-server data persistence using HMAC signatures, ensuring that data written to the database is cryptographically verified and that database keys are never exposed to the client side.
Sources: CLAUDE.md:18-19, README.md:21
Synthesis Engine: UCIS v5.1
The "Symphony" serves as the delivery mechanism for the Ultimate Content Intelligence & Implementation System (UCIS) v5.1. This engine deconstructs content into a 11-dimension knowledge product.
Dimension Structure
The architecture supports the generation of 11 distinct knowledge dimensions, including:
- Apex Intelligence (Executive ROI)
- Provenance & Virality Metrics
- Content Architecture & First Principles
- Psychological & Rhetorical Layer
- Core Intelligence (Insights Matrix)
- Comparative & Quantitative Analysis
- Implementation Systems & Workflows
- Semantic & Knowledge Graph Foundation
- Strategic Foresight & Trend Projections
- Credibility & Risk Audit
- Commercial Yield & Monetization Profiling
Sources: web/lib/prompts/ucis-v5.1.ts:77-313, design-system/HEX-YT-INTEL Design System (1)/README.md:13-15
Data Flow for Analysis
The sequence illustrates the cache-first approach followed by the transition to edge streaming if no cache is found.
Sources: GEMINI.md:46-65, CLAUDE.md:5-19
Technical Specifications
Runtime Infrastructure
The project enforces a "Frozen Stack Protocol" to ensure stability across the hybrid environment.
| Component | Specification |
|---|---|
| Node.js | 24.16.0 LTS (Strictly Pinned) |
| pnpm | 11.1.3 (Workspace Isolation) |
| Next.js | 16.2.6 |
| TypeScript | 5.6.2 |
| CSS Framework | Tailwind CSS + shadcn/ui |
Sources: GEMINI.md:20-27, CLAUDE.md:42-50
Hexagonal Lite Pattern
The system follows a Hexagonal Lite (Ports & Adapters) + Domain-Driven Design (DDD) pattern. This architectural choice separates business logic from infrastructure.
- Ports: Abstract interfaces (e.g.,
PersistencePort). - Adapters: Concrete implementations (e.g.,
SupabasePersistenceAdapter). - Domain Services: Core logic such as the
ReasoningEngineorLLMCascadereside inworker/src/services/.
Sources: GEMINI.md:126-141
Conclusion
The Hybrid Edge Architecture provides a robust framework for high-density content intelligence. By decoupling authentication from synthesis and employing a multi-cloud strategy, hex-yt-intel achieves a level of reliability and execution depth unachievable by standard serverless implementations. This "Symphony" ensures that the intensive UCIS v5.1 analysis can be performed on long-form content while maintaining data integrity through cryptographic persistence.
Sources: README.md:16-24, CLAUDE.md:1-19