Backend AI API Documentation

Dedicated AI backend service for training, MCP, agents, and platform intelligence

Backend AI API Documentation

The Backend AI API is a dedicated NestJS backend service running on port 3001 (locally) that handles all AI-specific functionality for the GoGrab platform.


🎯 Purpose

The Backend AI API is separate from backend-api to:


🏗️ Architecture

┌─────────────────────────────────────────────────┐
│              GoGrab Platform                    │
├─────────────────────────────────────────────────┤
│                                                 │
│  Frontend (gograb-space)                        │
│  Port 5200 (local)                              │
│         │                                       │
│         ├─────────────┬────────────────┐        │
│         │             │                │        │
│         ▼             ▼                ▼        │
│                                                 │
│  backend-api     backend-ai-api                 │
│  Port 3000       Port 3001                      │
│  /api/*          /ai-api/*                      │
│                                                 │
│  Services:       Services:                      │
│  - Auth          - Platform AI Training         │
│  - Users         - MCP Tools                    │
│  - Spaces        - Agent Orchestration          │
│  - Modules       - Vector Memory                │
│  - Analytics     - Intelligence Layer           │
│                  - Training Datasets            │
│                                                 │
└─────────────────────────────────────────────────┘

📚 Documentation


🚀 Quick Start

Local Development

# Start backend-ai-api only
yarn serve:backend-ai

# Or start both backends together
yarn serve:backends

Backend AI API will be available at: http://localhost:3001/ai-api

Health Check

# Local
curl http://localhost:3001/ai-api/health

# Production
curl https://backend-ai-api-production.up.railway.app/ai-api/health

🔑 Key Features

1. Platform AI Training

2. MCP (Model Context Protocol) Services

3. Agent Orchestration

4. Vector Memory & Embeddings

5. Platform Intelligence


🔧 Configuration

Environment Variables

# Required
NODE_ENV=production
PORT=3001  # Local (Railway uses dynamic PORT)
MONGODB_CONNECTION_STRING=your-connection-string
JWT_SECRET=your-secret  # MUST match backend-api!

# Optional
ANTHROPIC_API_KEY=sk-ant-xxx
OPENAI_API_KEY=sk-xxx

Shared with backend-api

⚠️ CRITICAL: The following must be identical between backend-api and backend-ai-api:


📊 Databases

The Backend AI API uses dedicated MongoDB databases:

Database Purpose
ai-agents Agent definitions, capabilities, performance
ai-memory Vector embeddings, semantic search
ai-tenants Tenant-specific AI learning (future)
ai-context Shared context with backend-api

🌐 Endpoints

Health & Status

Platform Agents

MCP Tools (Development AI)


🔗 Related Documentation

Backend API Documentation

MCP Documentation

Platform AI


🐛 Troubleshooting

Common Issues

Port Already in Use:

# Kill process on port 3001
lsof -ti:3001 | xargs kill -9

Authentication Fails:

MongoDB Connection Fails:


📞 Support


✅ Status


Last Updated: December 15, 2025
Version: 1.0.0
Status: Production-Ready ✅