Technical

Architecture

AutoPilot is a full-stack DeFi application spanning a Next.js frontend, Fastify API backend, PostgreSQL + Redis data layer, Stellar Horizon real-time streaming, and Soroban smart contracts.


  [Browser / Freighter Wallet]
         │  wallet signature
         ▼
  ┌─────────────────────────────┐
  │   Next.js 14 (Vercel Edge)  │  ← /onboarding, /dashboard, /chat
  │   Frontend + API Routes     │  ← /api/chat proxies to backend
  └──────────────┬──────────────┘
                 │ HTTP / JWT
                 ▼
  ┌─────────────────────────────┐
  │   Fastify Backend (Render)  │
  │   - Auth    - Vaults        │
  │   - Rules   - Goals         │
  │   - Chat → Groq AI          │
  └──┬───────────┬──────────────┘
     │           │
     ▼           ▼
  [PostgreSQL]  [Upstash Redis]
  (Neon DB)     (BullMQ + cursors)
     
  ┌─────────────────────────────┐
  │   Horizon SSE Engine        │
  │   Polls wallets every 60s   │
  │   On payment → runs rules   │
  │   Sends XLM to vault        │
  └──────────────┬──────────────┘
                 │ Stellar SDK
                 ▼
  ┌─────────────────────────────┐
  │   Stellar Testnet Network   │
  │   User Wallet               │
  │   Savings Vault Account     │
  │   Investment Vault Account  │
  │   Engine Account (AutoPilot)│
  └─────────────────────────────┘

Technology Stack

Frontend
Next.js 14 (App Router)React server components + client islands
TypeScriptFull end-to-end type safety
Tailwind CSSUtility-first styling with dark/light modes
Framer MotionFluid animations and page transitions
Freighter APIStellar wallet connection & signing
VercelEdge deployment with automatic CI/CD
Backend
FastifyHigh-performance Node.js HTTP server
TypeScriptShared type definitions with frontend
Stellar SDKTransaction building and signing
Groq SDKUltra-fast LLM API for AI rule parsing
BullMQRedis-backed job queue for payment retries
RenderAlways-on backend with Docker container
Smart Contracts (Soroban)
RustMemory-safe systems programming language
AutopilotProtocolRegistry & vault creation (SEP-56 structure)
AutomationRulesOn-chain execution limits & storage
Blend Vault IntegrationYield aggregation across DeFi pools
SEP-41 Token StandardReceipt tokens issued for yield vaults
Stellar DEXNative DCA swapping via pathPaymentStrictSend
Data & Infrastructure
PostgreSQL (Neon)Primary database — users, rules, vaults, goals
Redis (Upstash)Horizon cursors, spending limits, job queue
Stellar HorizonReal-time payment SSE stream + REST API
GitHub ActionsCI/CD for frontend, backend, contracts, security
Blockchain
Stellar TestnetXLM transfers — vaults are real Stellar accounts
Soroban SDKSmart contract framework for Stellar
Rust / WebAssemblySmart contract compiled to .wasm
FreighterNon-custodial browser wallet

Database Schema

User
idpublicKeyemail?dailyLimitweeklyLimitcreatedAt
Vault
iduserIdtype (savings|investment)publicKeysecretKey (encrypted)createdAt
Rule
iduserIdtriggeractionamountisPercentagememocreatedAt
AutomatedTransaction
iduserIdruleIdamounttypememotxHashpaymentIdcreatedAt
Goal
iduserIdlinkedRuleId?nametargetAmountcurrentAmountdeadlinecreatedAt

Learn about the Soroban smart contract layer.

Smart Contracts