System Architecture
Edge-Native System Architecture
AgentWiki is architected to run entirely on Cloudflare’s serverless edge infrastructure, ensuring sub-50ms latency across 300+ global data centers.
┌─────────────────────────────────────────────────────────────┐│ Frontend Layer ││ React 19 + BlockNote + TailwindCSS v4 ││ Cloudflare Pages (app.agentwiki.cc) │└────────────────────────┬────────────────────────────────────┘ │ HTTPS REST API │┌────────────────────────▼────────────────────────────────────┐│ API Gateway Layer ││ Hono on Cloudflare Workers (api.agentwiki.cc) ││ ├── Routes: Auth, Documents, Search, Graph, Secrets... ││ └── Middleware: AuthGuard, RateLimiter, CreditGuard │└────────────────────────┬────────────────────────────────────┘ │ ┌────────────────┼────────────────┐ │ │ │ ┌───▼──┐ ┌───▼──┐ ┌─────▼──────┐ │ D1 │ │ R2 │ │ Vectorize │ │(SQL) │ │Files │ │(Embeddings)│ └──────┘ └──────┘ └────────────┘ │ │ │ ┌───▼──┐ ┌───▼────┐ ┌─────▼──────┐ │ KV │ │ Queues │ │ Workers AI │ │Cache │ │(Async) │ │ (Inference)│ └──────┘ └────────┘ └────────────┘Core Infrastructure Components
- Cloudflare Workers (
packages/api): High-performance TypeScript API runtime powered by Hono. - Cloudflare D1 (SQLite): Primary relational database managed via Drizzle ORM, storing tenants, users, documents, folders, tags, and audit logs.
- Cloudflare Vectorize: Vector database indexing 768-dimensional document embeddings for semantic similarity and RAG suggestions.
- Cloudflare R2: Object storage for file uploads, static site bundles, and media assets.
- Cloudflare KV: Ultra-low latency cache for API key validation, rate-limiting counters, and session states.
- Cloudflare Queues: Async message broker for background text chunking, embedding generation, and AI summarization.