Skip to content

Eli5DeFi/StoryEngine

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

172 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Voidborne: The Silent Throne 🎭

Space Political Saga × Blockchain Prediction Market

Navigate deadly succession politics. Bet on which path shapes the narrative. Five houses. Five agendas. One choice that could shatter reality.

License: MIT TypeScript Next.js Powered by Bankr


🚀 Quick Start

Option 1: Automated Supabase Setup (Recommended)

# 1. Clone the repository
git clone https://github.com/eli5-claw/StoryEngine.git
cd StoryEngine

# 2. Set up Supabase database (5 minutes)
./scripts/setup-supabase.sh
# Script will guide you through:
# - Creating Supabase project
# - Configuring connection
# - Running migrations
# - Seeding data

# 3. Start development server
cd apps/web
pnpm dev

# 4. Open http://localhost:3000

Option 2: Manual Setup

# 1. Clone
git clone https://github.com/eli5-claw/StoryEngine.git
cd StoryEngine

# 2. Set up Supabase (see SUPABASE_SETUP.md)
# - Create project at https://supabase.com
# - Get connection string

# 3. Configure environment
cp .env.example .env
# Add your DATABASE_URL to .env

# 4. Install & migrate
pnpm install
cd packages/database
pnpm prisma migrate deploy
pnpm prisma db seed

# 5. Start dev server
cd ../../apps/web
pnpm dev

Deploy to production: See DEPLOY_NOW.md (15 minutes)


🎯 What is Voidborne?

An immersive space political narrative where:

  • 🎭 AI-powered story unfolds based on reader choices
  • 🎲 Bet on outcomes using USDC (stablecoin betting)
  • 💰 Winners earn 85% of the betting pool (parimutuel)
  • 🪙 $FORGE token trading fees fund future chapters (self-sustaining)
  • 📈 Shape the narrative through strategic betting

The Story

You are the heir to House Valdris, holder of the Silent Throne. Someone is Stitching new Threads—an art thought impossible. The five houses of the Grand Conclave demand answers. Your choices will determine the fate of reality itself.

How It Works

  1. Read the Story - AI-generated chapters with choices
  2. Bet on Choices - Predict which path AI will take
  3. AI Decides - Analyzes story coherence + reader preferences
  4. Win Rewards - 85% to winners, 12.5% treasury, 2.5% dev

Example Pool:

  • Total: 1,000 $FORGE
  • Choice A: 400 $FORGE (40% of pool)
  • Choice B: 600 $FORGE (60% of pool)
  • AI picks A → Winners share 850 $FORGE
  • Your 100 $FORGE bet → 212.5 $FORGE payout (2.125x)
  • Profit: +112.5 $FORGE 🎉

🏗️ Architecture

┌─────────────────────────────────────────────────────────────┐
│                    Frontend (Next.js 14)                    │
├─────────────────────────────────────────────────────────────┤
│  Landing Page    │  Story Reader   │  Betting Interface    │
└──────────┬───────┴─────────┬───────┴─────────────┬─────────┘
           │                 │                     │
           ▼                 ▼                     ▼
┌─────────────────┐  ┌─────────────────┐  ┌─────────────────┐
│   API Routes    │  │    Database     │  │  Bankr ($FORGE) │
│   (Next.js)     │  │   (Prisma +     │  │   Integration   │
│                 │  │   PostgreSQL)   │  │                 │
└────────┬────────┘  └────────┬────────┘  └────────┬────────┘
         │                    │                     │
         └────────────────────┴─────────────────────┘
                              │
                              ▼
                  ┌───────────────────────┐
                  │  Blockchain (Base)    │
                  │  • Betting Pools      │
                  │  • $FORGE Token       │
                  │  • Smart Contracts    │
                  └───────────────────────┘

📦 Project Structure

StoryEngine/
├── apps/
│   └── web/                # Next.js frontend
│       ├── src/
│       │   ├── app/        # Next.js app router
│       │   │   ├── api/    # API routes
│       │   │   └── story/  # Story reader pages
│       │   └── components/ # React components
│       └── package.json
├── packages/
│   ├── contracts/          # Solidity smart contracts (Foundry)
│   │   ├── src/
│   │   │   └── ChapterBettingPool.sol
│   │   └── test/
│   ├── database/           # Prisma schema + utilities
│   │   ├── prisma/
│   │   │   ├── schema.prisma
│   │   │   └── seed.ts
│   │   └── src/
│   └── bankr-integration/  # Bankr SDK wrapper
│       └── src/
│           ├── client.ts   # Main Bankr client
│           ├── token.ts    # $FORGE token manager
│           ├── trading.ts  # DCA, orders, automation
│           └── wallet.ts   # Cross-chain wallets
├── scripts/
│   ├── setup-database.sh   # Database setup script
│   └── quick-start.sh      # Full setup script
├── .env.example            # Environment variables template
├── docker-compose.yml      # PostgreSQL + Redis
├── DEPLOYMENT.md           # Deployment guide
├── BUILD_PROGRESS.md       # Development status
└── README.md               # This file

🛠️ Tech Stack

Frontend

  • Framework: Next.js 14 (App Router, React 18)
  • Styling: Tailwind CSS, Radix UI, Framer Motion
  • State: React Query (@tanstack/react-query)
  • Blockchain: viem, wagmi

Backend

  • API: Next.js API routes
  • Database: PostgreSQL + Prisma ORM
  • Cache: Redis (for real-time features)
  • AI: OpenAI GPT-4, Anthropic Claude
  • Images: DALL-E, Midjourney

Blockchain

  • Network: Base (EVM L2)
  • Contracts: Solidity + Foundry
  • Token: ERC-20 ($FORGE)
  • Wallet: Bankr cross-chain infrastructure

Infrastructure

  • Hosting: Vercel (frontend), Railway (database)
  • Bankr: Token + wallet management
  • CI/CD: GitHub Actions
  • Monitoring: Sentry (errors), UptimeRobot

⚡ Features

✅ Completed

Smart Contracts:

  • Parimutuel betting pools
  • 85/12.5/2.5 fee distribution
  • Time-locked betting periods
  • Winner payout calculation
  • 13 comprehensive test cases

Backend:

  • PostgreSQL database schema (Prisma)
  • User management (wallet-based auth)
  • Stories & chapters CRUD
  • Betting pool management
  • API routes with validation
  • Seed data for testing

Frontend:

  • Landing page (7 sections)
  • Story reading interface
  • Betting UI with live odds
  • Countdown timer (real-time)
  • Potential payout calculator
  • Chapter navigation
  • Responsive design
  • Animations (Framer Motion)

Integrations:

  • Bankr SDK wrapper
  • $FORGE token management
  • Trading automation (DCA, orders)
  • Wallet operations

⏳ In Progress

Phase 2 (This Week):

  • Wallet connection (wagmi + RainbowKit)
  • Blockchain transaction integration
  • AI story generation (GPT-4/Claude)
  • Pool resolution logic
  • Winner payout distribution

Phase 3 (Next Week):

  • Real-time updates (WebSockets)
  • User dashboard
  • Analytics
  • Mobile optimization

Phase 4 (This Month):

  • Mainnet deployment
  • Marketing site
  • Community features
  • DAO governance

🎮 Development

Prerequisites

  • Node.js 20+
  • pnpm 8+
  • PostgreSQL 15+ (or cloud database)
  • Bankr API key (get here)

Setup

# Install dependencies
pnpm install

# Set up environment
cp .env.example .env
# Edit .env with your DATABASE_URL and BANKR_API_KEY

# Set up database
./scripts/setup-database.sh

# Start development server
cd apps/web
pnpm dev

Database Commands

# Generate Prisma Client
pnpm db:generate

# Push schema to database
pnpm db:push

# Create migration
pnpm db:migrate

# Seed database
pnpm db:seed

# Open Prisma Studio
pnpm db:studio

Smart Contract Commands

cd packages/contracts

# Run tests
forge test -vvv

# Deploy to local network
pnpm contracts:deploy:local

# Deploy to Base Sepolia (testnet)
pnpm contracts:deploy:sepolia

# Deploy to Base mainnet
pnpm contracts:deploy:mainnet

Testing

# Run all tests
pnpm test

# Test smart contracts
pnpm test:contracts

# Test frontend (E2E)
pnpm test:e2e

# Type checking
pnpm type-check

# Linting
pnpm lint

📊 Self-Sustaining Economics

Revenue Streams:

  1. Betting pool fees (2.5% dev + 12.5% treasury)
  2. $FORGE trading fees (~0.3% per trade)
  3. Liquidity provider rewards

How It Works:

Users buy $FORGE → Trading fees collected (0.3%)
     ↓
Users bet $FORGE → Betting fees collected (2.5% + 12.5%)
     ↓
Trading fees fund AI compute (GPT-4, DALL-E, servers)
     ↓
Better stories → More users → More trading
     ↓
Loop repeats → Platform becomes self-sustaining ✅

Target Revenue (Month 1):

  • Betting fees: $2K/week
  • Trading fees: $3.5K/week
  • Total: $5.5K/week → Self-sustaining!

🪙 $FORGE Token

Platform token on Base with multiple utilities:

  • Betting Currency - Place bets on story choices
  • Governance - Vote on platform decisions
  • Rewards - Earn from winning bets
  • Fee Funding - Trading fees fund AI compute

Powered by Bankr:

  • Cross-chain wallets (Base, Ethereum, Polygon, Solana)
  • Gas-sponsored trades (smooth UX)
  • Automated trading (DCA, limit orders, stop-loss)
  • Self-sustaining revenue model

Launch $FORGE:

# Via Bankr skill (in any OpenClaw chat):
"launch a token named NarrativeForge with symbol FORGE on base with 1 billion supply"

# Via SDK:
import { TokenManager } from '@narrative-forge/bankr-integration'
const tokenAddress = await tokenManager.launchForgeToken()

📚 Documentation

Guides

Package Docs

External


🤝 Contributing

We welcome contributions! Here's how:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Please read CONTRIBUTING.md for details.


📝 License

This project is licensed under the MIT License - see the LICENSE file for details.


🙏 Acknowledgments

  • Bankr - Self-sustaining AI infrastructure
  • Base - Fast, low-cost L2 network
  • Prisma - Type-safe database ORM
  • Next.js - React framework for production
  • Vercel - Deployment platform

📞 Support


🗺️ Roadmap

Q1 2026 (Current)

  • Smart contracts + testing
  • Database schema
  • Landing page
  • Story reading interface
  • Betting UI
  • Bankr integration
  • Wallet connection
  • AI generation
  • Mainnet launch

Q2 2026

  • User dashboard
  • Analytics platform
  • Mobile app (React Native)
  • Real-time features
  • DAO governance

Q3 2026

  • Multi-language support
  • Advanced AI models
  • NFT story collectibles
  • Creator marketplace

Q4 2026

  • Cross-chain expansion
  • API for developers
  • White-label solution
  • Enterprise features

🎯 Vision

Make AI-generated interactive fiction mainstream.

We believe the future of storytelling is:

  • Interactive - Readers shape narratives
  • AI-powered - Infinite story possibilities
  • Community-driven - Collective intelligence
  • Self-sustaining - Revenue funds creation
  • Blockchain-native - Transparent and fair

NarrativeForge is building that future. 🚀


📈 Stats

Current Status (Feb 10, 2026):

  • 🏗️ Build Status: Core app complete
  • 📦 Code: 52 files, ~204KB
  • 🧪 Test Coverage: Smart contracts 100%
  • 🚀 Ready for: Database setup + deployment
  • 💰 Funding: Self-sustaining via $FORGE fees

Sample Data:

  • 1 story: "The Last Starforge" (Sci-Fi)
  • 2 chapters (1 resolved, 1 active)
  • 847 bettors, 142.5K $FORGE wagered
  • 94.7% AI decision accuracy

Ready to build the future of interactive fiction?

./scripts/quick-start.sh

Let's go! 🎉

About

Voidborne: The Silent Throne - Space Political Saga × Blockchain Prediction Market

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors