Skip to content

OlaGoose/InfiniteElements

Repository files navigation

🎮 Infinite Craft Next

Enterprise-grade infinite element synthesis game with multi-language support, cloud sync, and extensible architecture.

🚨 生产环境问题? 如果遇到 Vision API、登录认证或 Vercel 访问限制问题,请查看 生产环境问题修复指南

✨ Features

🎯 Core Features

  • 🤖 AI-Powered Synthesis - Generate unique elements using multiple AI providers
  • 🎨 Pixar-Inspired Design - Beautiful gradient-based UI with Disney/LEGO aesthetics
  • 🎯 Drag & Drop System - Smooth interactions powered by dnd-kit
  • 💾 Hybrid Storage - IndexedDB (local-first) + Supabase (cloud sync)
  • 🌐 Multi-Language - Support for English, 中文, 日本語, and more
  • 📱 Fully Responsive - Optimized for Mobile, Tablet, and Desktop
  • High Performance - Optimized for 60fps animations

🚀 Advanced Features

  • 🔐 Supabase Auth - Complete authentication system
  • 🔄 Real-time Sync - Multi-device synchronization
  • 🎭 Special Elements - Frames, Emotions, T-Shirts, Healing Cards
  • 🧩 Extensible Prompts - Multiple AI prompt strategies
  • 🎨 Plugin Architecture - Easy to extend with new element types
  • 🌓 Dark/Light Mode - Beautiful themes for day and night

🛠️ Tech Stack

Frontend

  • Framework: Next.js 15 (App Router)
  • Language: TypeScript 5.8+
  • Styling: Tailwind CSS
  • State Management: Zustand 5
  • Animations: Framer Motion
  • DnD: @dnd-kit
  • i18n: next-intl

Backend

  • Database: Supabase (PostgreSQL)
  • Auth: Supabase Auth
  • Storage: Supabase Storage
  • Realtime: Supabase Realtime

AI Providers

  • OpenAI (GPT-4, DALL-E)
  • Anthropic (Claude)
  • Google Gemini
  • Doubao (字节跳动)

🚀 Quick Start

Prerequisites

  • Node.js 20+
  • pnpm 9+
  • Supabase account

Installation

# 1. Install dependencies
pnpm install

# 2. Setup database (automated)
pnpm db:setup:local
# This will:
# - Start local Supabase in Docker
# - Create database tables
# - Apply migrations
# - Generate TypeScript types

# 3. Copy environment variables
cp env.example .env.local

# 4. Edit .env.local with your credentials
# Minimum required:
# - NEXT_PUBLIC_AIKIT_API_KEY (or other AI provider)
# - NEXT_PUBLIC_SUPABASE_URL (auto-generated by db:setup)
# - NEXT_PUBLIC_SUPABASE_ANON_KEY (auto-generated by db:setup)

# 5. Start development server
pnpm dev

Open http://localhost:3000

Quick Deploy (Production)

# 1. Deploy database to Supabase Cloud
pnpm db:setup:production

# 2. Deploy to Vercel
vercel --prod

# 3. Configure environment variables in Vercel Dashboard

See Quick Start Guide for detailed steps.

Database Setup

Option A: Automated Setup (Recommended)

# Local development
pnpm db:setup:local

# Production deployment
pnpm db:setup:production

Option B: Manual Setup

# Start local Supabase
pnpm supabase:start

# Apply migrations
pnpm db:migrate

# Generate types
pnpm supabase:types

Database Features

  • ✅ PostgreSQL 15
  • ✅ Row Level Security (RLS) enabled
  • ✅ Automatic migrations
  • ✅ TypeScript type generation
  • ✅ Local-first with cloud sync

See Database Setup Guide for details.

📁 Project Structure

infinite-craft-next/
├── src/
│   ├── app/                    # Next.js App Router
│   │   ├── [locale]/          # Internationalized routes
│   │   └── api/               # API routes
│   ├── components/            # React components
│   ├── lib/                   # Core libraries
│   │   ├── auth/             # Authentication
│   │   ├── storage/          # Hybrid storage
│   │   ├── i18n/             # Internationalization
│   │   ├── prompt-engine/    # Prompt system
│   │   ├── elements/         # Element registry
│   │   └── model-runtime/    # AI providers
│   ├── store/                 # State management
│   ├── hooks/                 # Custom hooks
│   └── types/                 # TypeScript types
├── supabase/                  # Database schema
├── messages/                  # Translation files
└── public/                    # Static assets

🎮 How to Play

  1. Start with Basic Elements - Water 💧, Fire 🔥, Wind 🌬️, Earth 🌍
  2. Drag to Combine - Drag elements onto each other to synthesize
  3. Discover New Elements - AI generates unique combinations
  4. Collect & Create - Build your element collection
  5. Special Elements - Use frames to create masterpieces

🌐 Internationalization

Supported Languages

  • 🇺🇸 English (en)
  • 🇨🇳 简体中文 (zh-CN)
  • 🇯🇵 日本語 (ja)

Add New Language

  1. Create translation file in messages/[locale].json
  2. Add locale to src/lib/i18n/config.ts
  3. Restart server

🏗️ Architecture

Hybrid Storage

Application
  ↓
HybridStorage
  ├── IndexedDB (Local-first)
  │   - Fast reads
  │   - Offline support
  │   - Optimistic updates
  └── Supabase (Cloud sync)
      - Multi-device
      - Real-time
      - Backup

Extensible Prompts

// Register custom strategy
promptEngine.registerStrategy('custom', {
  id: 'custom',
  template: customTemplate,
  plugins: ['educational', 'localization']
});

Plugin-based Elements

// Register new element type
elementRegistry.register('custom', CustomElement);

🔧 Development

Commands

Development

pnpm dev              # Start dev server
pnpm build            # Build for production
pnpm start            # Start production server
pnpm type-check       # TypeScript check
pnpm lint             # ESLint check
pnpm format           # Format code

Database Management

# Setup
pnpm db:setup                   # Interactive setup wizard
pnpm db:setup:local             # Setup local database
pnpm db:setup:production        # Setup production database

# Migrations
pnpm db:migrate                 # Apply migrations (local)
pnpm db:migrate:production      # Apply migrations (production)
pnpm db:migrate:create [name]   # Create new migration
pnpm db:migrate:status          # Check migration status
pnpm db:rollback                # Rollback local database

# Supabase CLI
pnpm supabase:start             # Start local Supabase
pnpm supabase:stop              # Stop local Supabase
pnpm supabase:reset             # Reset database
pnpm supabase:types             # Generate TypeScript types

Environment Check

pnpm check-env        # Validate environment variables

Environment Variables

See .env.local.example for all available options.

Required:

  • NEXT_PUBLIC_SUPABASE_URL
  • NEXT_PUBLIC_SUPABASE_ANON_KEY
  • At least one AI provider API key

📝 Documentation

Getting Started

Deployment & Infrastructure

Architecture & Development

🤝 Contributing

Contributions are welcome! Please read CONTRIBUTING.md for details.

📄 License

MIT License - see LICENSE for details.

🙏 Acknowledgments


Built with ❤️ using Next.js 15, Supabase, and AI

About

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors