High-Level Architecture Diagram
Component Overview
| Layer | Location | Role |
|---|---|---|
| Frontend | pages/*.tsx, components/ | User flows: Idea → Intent → Platform → Payment → Execution → Completion |
| API | pages/api/*.ts | Serverless handlers; call lib/ and persist via Prisma |
| Workflow | lib/x402.ts | Stages, WorkflowContext, getWorkflowContextDB, updateWorkflowContextDB |
| AI | lib/openai.ts | processIdea, refineIntent, selectPlatform, executeX402Workflow (OpenRouter) |
| Agents | lib/platform-templates.ts, lib/x402.ts | getAgentForFile, AGENT_ROLES, generatePlatformDeliverables |
| A2A | lib/a2a.ts | Agent-to-Agent message bus, sendA2ARequest, shareA2AData |
| Payments | lib/solana.ts, api/dodo/* | Solana validation, Dodo checkout, webhooks |
| Data | lib/prisma.ts, prisma/schema.prisma | Workflow, User, Transaction, AgentStat, ZipFile, etc. |
Technology Stack
| Area | Technologies |
|---|---|
| Runtime | Node.js 18+ |
| Framework | Next.js 14 (Pages Router) |
| Language | TypeScript |
| AI | OpenRouter (GROK-4, Qwen 3, Gemini 2.5) |
| Database | PostgreSQL, Prisma ORM |
| Payments | Solana (Helius RPC, $SCRIPT/SPL), Dodo (card/UPI) |
| Frontend | React 18, Tailwind CSS, Reown AppKit / Phantom |
Design Decisions
- Pages Router — API and pages use
pages/; App Router is not used for core workflow. - Workflow state — Prefer
getWorkflowContextDB/updateWorkflowContextDB; in-memory inx402is fallback when DB is unavailable. - AI provider — OpenRouter for multi-model support;
DEFAULT_MODELandOPENROUTER_API_KEY_*select provider. - Unified pricing —
UNIFIED_PRICE_SCRIPT/UNIFIED_PRICE_USD; platform choice does not change payment amount. - Execution —
generatePlatformDeliverablesinplatform-templatesruns agents in parallel by file assignment;getAgentForFilemaps paths to ProductManager, FrontendDev, BackendDev, DevOpsEngineer, ToolManager. - Admin APIs — No built-in auth in handlers; in production they should be protected (e.g. API key, role-based auth).