A real-time prediction market game with autonomous NPCs, perpetual futures, and gamified social mechanics.
# 1. Install
bun install
# 2. Configure environment
cp .env.example .env.local
# Edit .env.local with your Privy credentials + GROQ_API_KEY
# 3. Setup database
bun run prisma:generate
bun run prisma:migrate
bun run prisma:seed
# 4. (Optional) Enable Agent0 Integration
# Add to .env.local:
# AGENT0_ENABLED=true
# BASE_SEPOLIA_RPC_URL=...
# BABYLON_GAME_PRIVATE_KEY=...
# Then register Babylon: bun run scripts/register-babylon-game.ts
# 5. Start development
bun run dev # ← Automatically starts web + game engine!
Visit http://localhost:3000 - everything runs and generates content automatically!
Default Mode (Recommended):
bun run dev # ← Web + Game Engine (both automatically!)
Runs both web server AND game daemon. Content generates every 60 seconds.
Web Only (No Content Generation):
bun run dev:web-only # Just Next.js, no daemon
Use if you're only working on frontend and don't need live content.
Serverless Mode (Test Vercel Cron Locally):
bun run dev:cron-mode # Web + Cron simulator (not daemon)
Tests the serverless cron endpoint instead of daemon. Good for verifying Vercel behavior.
The application uses Server-Sent Events (SSE) for real-time updates (Vercel-compatible): - Feed updates (new posts) - Market price changes - Breaking news - Chat messages
For Production (Vercel): Optionally set up Redis for cross-instance broadcasting:
# Add to Vercel environment variables
UPSTASH_REDIS_REST_URL=https://your-redis-url.upstash.io
UPSTASH_REDIS_REST_TOKEN=your-token
Babylon is configured as a Farcaster Mini App with automatic authentication. Users opening your app from Farcaster/Warpcast are logged in automatically!
https://babylon.marketVisit https://dashboard.privy.io/ and configure:
Enable Farcaster: - Navigate to: User management → Authentication → Socials - Enable Farcaster
⚠️ CRITICAL: Add Allowed Domains:
- Navigate to: Configuration → App settings → Domains
- Add these domains:
- ✅ https://babylon.market (your production domain)
- ⚠️ https://farcaster.xyz ← REQUIRED for Mini Apps!
- ✅ http://localhost:3000 (for development)
Why
https://farcaster.xyz? Required for iframe-in-iframe support that Farcaster Mini Apps use.
Set Callback URL:
- Add: https://babylon.market/api/auth/farcaster/callback
Ensure these are set in production:
NEXT_PUBLIC_PRIVY_APP_ID=your_privy_app_id
PRIVY_APP_SECRET=your_privy_app_secret
vercel --prod
Create a cast in Warpcast:
Check out Babylon! 🏛️
https://babylon.market
Click to launch → Users are automatically logged in! ✨
@farcaster/miniapp-sdkimport { useFarcasterMiniApp } from '@/components/providers/FarcasterFrameProvider'
function MyComponent() {
const { isMiniApp, fid, username } = useFarcasterMiniApp()
if (isMiniApp) {
return
Welcome from Farcaster, {username}!
}
return
Welcome to Babylon!
}
Complete Synpress testing implementation covering every page, button, and feature!
# Verify tests work NOW (no setup):
bun test tests/unit/
# ✅ 19/19 PASS
All your requirements are tested in tests/synpress/00-critical-path.spec.ts:
✅ Load feed
✅ Comment on feed
✅ Post to feed
✅ Like feed items
✅ Visit markets
✅ Buy/sell all market types
✅ Leaderboard + ALL buttons
✅ Rewards + ALL actions
bun run test:critical # Your requirements (5 min)
bun run test:complete # All pages + buttons (15 min)
bun run test # Everything (40 min)
See START_TESTING_NOW.md for quick start!
$ claude mcp add babylon \
-- python -m otcore.mcp_server <graph>