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
TypeScript — Full end-to-end type safety
Tailwind CSS — Utility-first styling with dark/light modes
Framer Motion — Fluid animations and page transitions
Freighter API — Stellar wallet connection & signing
Vercel — Edge deployment with automatic CI/CD
Backend
Fastify — High-performance Node.js HTTP server
TypeScript — Shared type definitions with frontend
Stellar SDK — Transaction building and signing
Groq SDK — Ultra-fast LLM API for AI rule parsing
BullMQ — Redis-backed job queue for payment retries
Render — Always-on backend with Docker container
Smart Contracts (Soroban)
Rust — Memory-safe systems programming language
AutopilotProtocol — Registry & vault creation (SEP-56 structure)
AutomationRules — On-chain execution limits & storage
Blend Vault Integration — Yield aggregation across DeFi pools
SEP-41 Token Standard — Receipt tokens issued for yield vaults
Stellar DEX — Native DCA swapping via pathPaymentStrictSend
Data & Infrastructure
PostgreSQL (Neon) — Primary database — users, rules, vaults, goals
Redis (Upstash) — Horizon cursors, spending limits, job queue
Stellar Horizon — Real-time payment SSE stream + REST API
GitHub Actions — CI/CD for frontend, backend, contracts, security
Blockchain
Stellar Testnet — XLM transfers — vaults are real Stellar accounts
Soroban SDK — Smart contract framework for Stellar
Rust / WebAssembly — Smart contract compiled to .wasm
Freighter — Non-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