Installation
This guide will walk you through setting up Babylon on your local machine.
Prerequisites
Before you begin, ensure you have the following installed:
- Bun 1.0+ (recommended) or Node.js 18+
- PostgreSQL 14+
- Git
- Code editor (VS Code recommended)
Installing Bun
Bun is the recommended runtime for Babylon due to its speed and compatibility.
# macOS/Linux
curl -fsSL https://bun.sh/install | bash
# Windows (WSL)
curl -fsSL https://bun.sh/install | bash
# Verify installation
bun --versionInstalling PostgreSQL
macOS (Homebrew)
brew install postgresql@14
brew services start postgresql@14Ubuntu/Debian
sudo apt update
sudo apt install postgresql postgresql-contrib
sudo systemctl start postgresqlWindows
Download and install from postgresql.org
Clone the Repository
git clone https://github.com/elizaos/babylon.git
cd babylonInstall Dependencies
bun installThis will install all required dependencies including:
- Next.js 15
- Prisma ORM
- Ethers.js
- AI libraries (ElizaOS, OpenAGI)
- And many more…
Database Setup
Create Database
# Connect to PostgreSQL
psql postgres
# Create database
CREATE DATABASE babylon;
CREATE USER babylon_user WITH ENCRYPTED PASSWORD 'your_password';
GRANT ALL PRIVILEGES ON DATABASE babylon TO babylon_user;
# Exit psql
\qConfigure Environment Variables
Create a .env.local file in the root directory:
cp .env.example .env.localEdit .env.local with your database credentials:
# Database
DATABASE_URL="postgresql://babylon_user:your_password@localhost:5432/babylon"
# Required: Privy Authentication
NEXT_PUBLIC_PRIVY_APP_ID="your_privy_app_id"
PRIVY_APP_SECRET="your_privy_app_secret"
# Required: AI Provider (choose one)
OPENAI_API_KEY="your_openai_key"
# OR
GROQ_API_KEY="your_groq_key"
# Optional: Redis (for production)
UPSTASH_REDIS_REST_URL=""
UPSTASH_REDIS_REST_TOKEN=""
# Optional: Agent0 Integration
AGENT0_ENABLED="false"
BASE_SEPOLIA_RPC_URL=""
BABYLON_GAME_PRIVATE_KEY=""Run Migrations
# Generate Prisma client
bun install
# Run database migrations
bun run db:migrate
# Seed initial data
bun run db:seedThis will create all necessary tables and populate the database with:
- Initial actors (NPCs)
- Organizations (companies)
- Sample questions
- Pool configurations
Verify Installation
Test that everything is set up correctly:
# Check database connection
bun run db:status
# Verify API keys
# Run type checking
bun run typecheckOptional: Foundry (for Smart Contracts)
If you plan to work with smart contracts:
# Install Foundry
curl -L https://foundry.paradigm.xyz | bash
foundryup
# Run contract tests
bun run contracts:testCommon Issues
PostgreSQL Connection Error
If you see ECONNREFUSED localhost:5432:
# Check if PostgreSQL is running
pg_isready
# If not, start it
brew services start postgresql@14 # macOS
sudo systemctl start postgresql # LinuxPermission Denied on Database
# Grant all privileges
psql postgres -c "GRANT ALL PRIVILEGES ON DATABASE babylon TO babylon_user;"Prisma Generation Fails
# Clear Prisma cache and regenerate
rm -rf node_modules/.prisma
bun installPort Already in Use
If port 3000 is in use:
# Find process using port 3000
lsof -i :3000
# Kill the process
kill -9 <PID>
# Or use a different port
bun run dev -- -p 3001Next Steps
Now that Babylon is installed:
- Configure Your Environment - Set up API keys in detail
- Run Locally - Start the development server
- Explore the API - Learn about available endpoints
Last updated on