Cloud (Backend)

Next.js backend - Sync service only

Overview

The Cloud backend is a lightweight sync service that does NOT execute AI agents. All agent execution happens on mobile devices for better performance, cost, and privacy.

Platform

Next.js 15 + Prisma

Lines of Code

~800 lines (16 files)

Cost

$18-20/month

API Routes

Authentication

POST /api/auth/sign-in/google - Google OAuth

GET /api/auth/get-session - Get current session

Bots

GET /api/bots - List user's bots

POST /api/bots - Create new bot

PATCH /api/bots/:id - Update bot

DELETE /api/bots/:id - Delete bot

Devices

GET /api/devices - List user's devices

POST /api/devices - Register device

Database Schema

User - User accounts (Google OAuth)
Robot - Physical ESP32 devices
Bot - AI agents with configurations
Tool - Blockly/MCP/Built-in tools
KnowledgeBase - RAG knowledge bases
Conversation - Chat history