Skip to content

Latest commit

 

History

History
191 lines (138 loc) · 4.64 KB

File metadata and controls

191 lines (138 loc) · 4.64 KB

🎮 Farcaster 2048 - Mainnet Version

A modern 2048 game built for Farcaster with blockchain integration, global leaderboard, and wallet authentication.

🌐 Deployed on Base Mainnet

Farcaster 2048 License

✨ Features

  • 🎯 Classic 2048 Gameplay - Smooth, responsive game mechanics
  • 🟣 Purple Theme - Beautiful purple color scheme
  • 🌐 Global Leaderboard - Compete with players worldwide
  • 🔐 Wallet Authentication - Connect with MetaMask or Farcaster
  • 📊 Usage Statistics - Track your gaming stats
  • ⛓️ Blockchain Integration - Base Mainnet integration (real ETH required)
  • 🎨 Farcaster Mini App - Native Farcaster experience

🚀 Quick Start

Prerequisites

  • Node.js 22.11.0+ (for Farcaster SDK)
  • MongoDB Atlas Account (free)
  • npm or yarn

Installation

# Clone repository
git clone https://github.com/YOUR_USERNAME/farcaster-2048.git
cd farcaster-2048

# Setup backend
cd backend
npm install

# Create .env file
cp .env.example .env
# Edit .env with your MongoDB connection string

# Start backend
npm start

# Start frontend (new terminal)
cd ..
python3 -m http.server 8000

Access

📚 Documentation

All documentation files are located in the docs/ folder:

🏗️ Architecture

Frontend (Vercel)
    ↓
Backend API (Railway/Render)
    ↓
MongoDB Atlas (Database)
    ↓
Base Blockchain (Optional)

🔧 Configuration

Backend Environment Variables

MONGODB_URI=mongodb+srv://...
PORT=3000
BLOCKCHAIN_ENABLED=false

Frontend Configuration

// Set API URL in index.html or config.js
window.API_URL = 'https://your-backend.railway.app';

📦 Project Structure

farcaster-2048/
├── backend/
│   ├── server.js          # Express server
│   ├── db.js              # MongoDB connection
│   ├── blockchain.js      # Blockchain integration
│   └── .env               # Environment variables
├── index.html             # Main HTML file
├── game.js                # Game logic
├── wallet.js              # Wallet integration
├── style.css              # Styles
├── manifest.json          # Farcaster manifest
└── vercel.json            # Vercel config

🎮 How to Play

  1. Enter your name (or connect wallet)
  2. Use arrow keys to move tiles
  3. Combine same numbers to create larger ones
  4. Try to reach 2048!
  5. Your score is automatically saved to the global leaderboard

🔐 Wallet Features

  • MetaMask Integration - Connect with MetaMask
  • Farcaster Auth - Native Farcaster authentication
  • Message Signing - Identity verification (no gas fees)
  • Statistics Tracking - Track your gaming stats

📊 Leaderboard

  • Global leaderboard showing top players
  • Player names (wallet addresses hidden)
  • Real-time updates
  • Persistent storage in MongoDB

⛓️ Blockchain (Base Mainnet)

  • Base Mainnet integration (chainId: 8453)
  • On-chain score storage (requires real ETH for gas)
  • Hybrid approach (MongoDB + Blockchain)
  • Smart contract deployed on Base Mainnet
  • ⚠️ IMPORTANT: This is the mainnet version - real ETH is required for transactions

🚀 Deployment

Vercel (Frontend)

vercel --prod

Railway/Render (Backend)

  1. Connect GitHub repository
  2. Set environment variables
  3. Deploy

Farcaster

  1. Enable Developer Mode
  2. Create manifest
  3. Publish app

See Deployment Guide for details.

🛠️ Development

# Backend
cd backend
npm start

# Frontend
python3 -m http.server 8000

📝 License

MIT

🙏 Acknowledgments

  • Built for Farcaster
  • Inspired by the classic 2048 game
  • Powered by MongoDB Atlas and Base network

🔗 Links