Skip to main content

High-Level Architecture Diagram

┌─────────────────────────────────────────────────────────────────────────────┐
│                        Frontend (Next.js Pages Router)                        │
│  ┌──────────┐  ┌──────────┐  ┌──────────┐  ┌──────────┐  ┌──────────┐      │
│  │   Home   │→ │  Intent  │→ │ Platform │→ │ Payment  │→ │Execution │→ ...  │
│  │   (Idea) │  │   Page   │  │   Page   │  │   Page   │  │   Page   │      │
│  └──────────┘  └──────────┘  └──────────┘  └──────────┘  └──────────┘      │
│       │             │             │             │             │              │
│       ↓             ↓             ↓             ↓             ↓              │
│  ┌──────────────────────────────────────────────────────────────────────┐   │
│  │                    API Routes (pages/api/)                            │   │
│  │  /idea  /intent  /platform  /payment  /execute  /dodo/*  /admin/*    │   │
│  └──────────────────────────────────────────────────────────────────────┘   │
└─────────────────────────────────────────────────────────────────────────────┘


┌─────────────────────────────────────────────────────────────────────────────┐
│                         Backend / Lib (lib/)                                 │
│  ┌──────────────┐  ┌──────────────┐  ┌──────────────┐  ┌──────────────┐    │
│  │   openai.ts  │  │    x402.ts   │  │    a2a.ts    │  │   solana.ts  │    │
│  │ (OpenRouter) │  │  (Workflow)  │  │ (Agent Comms)│  │ (Payments)   │    │
│  └──────────────┘  └──────────────┘  └──────────────┘  └──────────────┘    │
│  ┌──────────────┐  ┌──────────────┐  ┌──────────────┐                     │
│  │  platform-   │  │   prisma.ts  │  │  constants   │                     │
│  │  templates   │  │ (PostgreSQL) │  │              │                     │
│  └──────────────┘  └──────────────┘  └──────────────┘                     │
└─────────────────────────────────────────────────────────────────────────────┘

        ┌────────────────────────────┼────────────────────────────┐
        ↓                            ↓                            ↓
┌──────────────┐            ┌──────────────┐            ┌──────────────┐
│  OpenRouter  │            │  PostgreSQL  │            │  Helius RPC  │
│  (GROK etc)  │            │  (Prisma)    │            │  / Dodo      │
└──────────────┘            └──────────────┘            └──────────────┘

Component Overview

LayerLocationRole
Frontendpages/*.tsx, components/User flows: Idea → Intent → Platform → Payment → Execution → Completion
APIpages/api/*.tsServerless handlers; call lib/ and persist via Prisma
Workflowlib/x402.tsStages, WorkflowContext, getWorkflowContextDB, updateWorkflowContextDB
AIlib/openai.tsprocessIdea, refineIntent, selectPlatform, executeX402Workflow (OpenRouter)
Agentslib/platform-templates.ts, lib/x402.tsgetAgentForFile, AGENT_ROLES, generatePlatformDeliverables
A2Alib/a2a.tsAgent-to-Agent message bus, sendA2ARequest, shareA2AData
Paymentslib/solana.ts, api/dodo/*Solana validation, Dodo checkout, webhooks
Datalib/prisma.ts, prisma/schema.prismaWorkflow, User, Transaction, AgentStat, ZipFile, etc.

Technology Stack

AreaTechnologies
RuntimeNode.js 18+
FrameworkNext.js 14 (Pages Router)
LanguageTypeScript
AIOpenRouter (GROK-4, Qwen 3, Gemini 2.5)
DatabasePostgreSQL, Prisma ORM
PaymentsSolana (Helius RPC, $SCRIPT/SPL), Dodo (card/UPI)
FrontendReact 18, Tailwind CSS, Reown AppKit / Phantom

Design Decisions

  1. Pages Router — API and pages use pages/; App Router is not used for core workflow.
  2. Workflow state — Prefer getWorkflowContextDB / updateWorkflowContextDB; in-memory in x402 is fallback when DB is unavailable.
  3. AI provider — OpenRouter for multi-model support; DEFAULT_MODEL and OPENROUTER_API_KEY_* select provider.
  4. Unified pricingUNIFIED_PRICE_SCRIPT / UNIFIED_PRICE_USD; platform choice does not change payment amount.
  5. ExecutiongeneratePlatformDeliverables in platform-templates runs agents in parallel by file assignment; getAgentForFile maps paths to ProductManager, FrontendDev, BackendDev, DevOpsEngineer, ToolManager.
  6. Admin APIs — No built-in auth in handlers; in production they should be protected (e.g. API key, role-based auth).