Skip to content

Goodnessukaigwe/jeteeah

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

50 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐ŸŽฎ Jeteeah - Blockchain Snake Game on Linera

A modern, blockchain-powered Snake game built with Next.js and Linera blockchain technology, featuring real-time score tracking, token rewards, customizable skins, and achievement systems.

โšก Quick Start

Get started in 5 minutes!

pnpm install
npm run setup:local
npm run build:backend
npm run deploy:local
npm run dev

๐Ÿ“– Full Guide: See QUICKSTART.md for detailed setup instructions.

๐ŸŒ Deploy to Testnet: See TESTNET_DEPLOYMENT.md to connect to Linera Testnet Conway.

๐Ÿ“Š Blockchain Status: See BLOCKCHAIN_STATUS.md for integration status and infrastructure details.

๐Ÿš€ Features

Blockchain-Powered Gameplay

  • On-Chain Score Tracking: Scores recorded on Linera blockchain
  • Wallet Integration: Connect Linera wallet or use mock mode for testing
  • Point System: Earn points stored on-chain, redeemable for rewards
  • Leaderboard: Compete with players globally with verified scores

Classic Snake Gameplay

  • Traditional Mechanics: Eat food to grow, score points, and avoid self-collision
  • Responsive Controls: Arrow keys with smooth animations
  • Score Tracking: Real-time score display with blockchain verification

Web3 Features

  • Token System: Earn tokens by playing and achieving milestones
  • Skin Customization: Purchase and equip different snake skins with earned points
  • Achievement Rewards: Unlock achievements and earn on-chain token rewards
  • Transaction History: View all your blockchain interactions

User Interface

  • Modern Design: Sleek dark theme with vibrant accents and particle effects
  • Responsive Layout: Optimized for mobile and desktop play
  • Visual Feedback: Smooth animations, confetti effects, and hover interactions
  • Blockchain Status: Real-time sync indicator and transaction notifications

๐Ÿ› ๏ธ Tech Stack

Frontend

  • Framework: Next.js 16 with App Router
  • UI Library: React 19 with TypeScript
  • Styling: Tailwind CSS v4
  • UI Components: Radix UI, Lucide React, React Icons
  • State Management: React Context API
  • Blockchain Client: GraphQL with graphql-request

Backend

Linera Smart Contract

  • Language: Rust
  • Blockchain: Linera Protocol
  • Contract: WASM-compiled smart contract
  • Services: GraphQL API for queries

Multiplayer Backend Service

  • Runtime: Node.js 20
  • Framework: Express.js
  • Real-time: Socket.IO for WebSocket connections
  • Language: TypeScript
  • Port: 3001 (default)

DevOps

  • Containerization: Docker & Docker Compose
  • Local Node: Linera local development network
  • Build Tools: Cargo, Rust toolchain

๐Ÿ“ฆ Installation & Setup

Option 1: Quick Start (Recommended)

See QUICKSTART.md for a 5-minute setup guide.

Option 2: Manual Setup

  1. Clone the repository

    git clone https://github.com/Goodnessukaigwe/jeteeah.git
    cd jeteeah
  2. Install dependencies

    pnpm install
  3. Setup environment

    cp .env.example .env.local
  4. Start Linera node (Docker)

    npm run setup:local
  5. Build and deploy contract

    npm run build:backend
    npm run deploy:local

    Update .env.local with the chain and app IDs from deployment output.

  6. Run the development server

    npm run dev
    ```bash
    npm run dev

    Open http://localhost:3000

๐Ÿ“š Documentation

๐ŸŽฎ How to Play

  1. Connect Wallet: Click "Connect Wallet" or use mock mode for testing
  2. Enable Blockchain Mode: Toggle the blockchain switch ON for on-chain gameplay
  3. Start Game: Click "Start Game" to begin
  4. Controls:
    • Arrow Keys: Move the snake (Up, Down, Left, Right)
    • Pause: Click pause button or press ESC
  5. Objective: Eat the food to grow and increase your score
  6. Scoring:
    • Each food = 5 points
    • Points are recorded on-chain at game end
    • High scores are saved to blockchain
  7. Rewards: Earn on-chain points to unlock skins and achievements

๐Ÿ”ง Development Commands

# Frontend
npm run dev              # Start Next.js dev server
npm run build            # Build for production
npm run start            # Start production server

# Backend Service (Multiplayer)
npm run backend:dev      # Start backend dev server
npm run backend:install  # Install backend dependencies
npm run backend:build    # Build backend
npm run dev:all          # Run frontend + backend concurrently

# Blockchain (Linera Smart Contract)
npm run setup:local      # Setup local Linera node
npm run build:backend    # Build smart contract (Note: conflicts with backend:build)
npm run deploy:local     # Deploy to local node

# Docker
npm run docker:up        # Start all services (Linera + Backend)
npm run docker:down      # Stop all services
npm run docker:logs      # View logs
npm run docker:reset     # Reset blockchain data

# Utilities
npm run linera:info      # Show wallet info

๐Ÿ“ Project Structure

jeteeah/
โ”œโ”€โ”€ app/                          # Next.js app directory
โ”‚   โ”œโ”€โ”€ contexts/                 # React contexts
โ”‚   โ”‚   โ””โ”€โ”€ GameContext.tsx       # Blockchain-integrated game state
โ”‚   โ”œโ”€โ”€ game/                     # Main game page
โ”‚   โ”œโ”€โ”€ gameover/                 # Game over page
โ”‚   โ”œโ”€โ”€ landing/                  # Landing page
โ”‚   โ”œโ”€โ”€ multiplayer/              # Multiplayer game modes
โ”‚   โ”œโ”€โ”€ reward/                   # Rewards/achievements page
โ”‚   โ”œโ”€โ”€ skin/                     # Skin customization page
โ”‚   โ”œโ”€โ”€ start/                    # Game start page
โ”‚   โ”œโ”€โ”€ wallet/                   # Wallet connection page
โ”‚   โ””โ”€โ”€ leaderboard/              # Global leaderboard
โ”œโ”€โ”€ backend/                      # Multiplayer Backend Service (Node.js)
โ”‚   โ”œโ”€โ”€ api/
โ”‚   โ”‚   โ”œโ”€โ”€ config/               # Server configuration
โ”‚   โ”‚   โ”œโ”€โ”€ service/              # Game room management
โ”‚   โ”‚   โ””โ”€โ”€ types/                # TypeScript types
โ”‚   โ”œโ”€โ”€ app.ts                    # Express app setup
โ”‚   โ”œโ”€โ”€ server.ts                 # Server entry point
โ”‚   โ”œโ”€โ”€ Dockerfile                # Docker configuration
โ”‚   โ””โ”€โ”€ package.json              # Backend dependencies
โ”œโ”€โ”€ smart-contract/               # Linera Smart Contract (Rust)
โ”‚   โ”œโ”€โ”€ src/
โ”‚   โ”‚   โ”œโ”€โ”€ contract.rs           # Game logic & operations
โ”‚   โ”‚   โ”œโ”€โ”€ service.rs            # GraphQL service
โ”‚   โ”‚   โ”œโ”€โ”€ state.rs              # Blockchain state
โ”‚   โ”‚   โ””โ”€โ”€ lib.rs                # Contract entry point
โ”‚   โ””โ”€โ”€ tests/                    # Contract tests
โ”œโ”€โ”€ components/                   # React components
โ”‚   โ”œโ”€โ”€ ui/                       # Reusable UI components
โ”‚   โ”œโ”€โ”€ AchievementCard.tsx       # Achievement display
โ”‚   โ”œโ”€โ”€ BlockchainStatus.tsx      # Sync status indicator
โ”‚   โ”œโ”€โ”€ Leaderboard.tsx           # Leaderboard component
โ”‚   โ”œโ”€โ”€ ParticleEffects.tsx       # Visual effects
โ”‚   โ”œโ”€โ”€ PointsDashboard.tsx       # Points overview
โ”‚   โ”œโ”€โ”€ SkinCard.tsx              # Skin selection
โ”‚   โ”œโ”€โ”€ TransactionNotification.tsx # TX notifications
โ”‚   โ””โ”€โ”€ WalletButton.tsx          # Wallet connection
โ”œโ”€โ”€ lib/                          # Utilities & blockchain
โ”‚   โ”œโ”€โ”€ contract-operations.ts    # Blockchain operations
โ”‚   โ”œโ”€โ”€ linera-client.ts          # GraphQL client
โ”‚   โ”œโ”€โ”€ types.ts                  # TypeScript types
โ”‚   โ””โ”€โ”€ utils.ts                  # Helper functions
โ”œโ”€โ”€ hooks/                        # Custom React hooks
โ”‚   โ””โ”€โ”€ useLineraWallet.ts        # Wallet management
โ”œโ”€โ”€ scripts/                      # Build & deployment
โ”‚   โ”œโ”€โ”€ setup-local.sh            # Local env setup
โ”‚   โ”œโ”€โ”€ build-backend.sh          # Contract build
โ”‚   โ””โ”€โ”€ deploy-local.sh           # Contract deployment
โ”œโ”€โ”€ docker-compose.yml            # All services orchestration
โ”œโ”€โ”€ linera.toml                   # Project configuration
โ””โ”€โ”€ .devcontainer/                # VSCode dev container

๐ŸŽฏ Key Features

๐Ÿš€ Deployment

Deploy to Testnet

  1. Update Environment Variables:

    cp .env.example .env.local
    # Edit .env.local with testnet values

2. **Build Contract**:

   ```bash
   npm run build:backend
   ```

3. **Deploy Contract**:

   ```bash
   linera project publish-and-create
   ```

4. **Update Frontend Config**:
   Update `.env.local` with your deployed chain/app IDs

5. **Deploy Frontend** (Vercel):
   ```bash
   vercel
   ```

### Deploy Frontend Only

The easiest way to deploy the frontend is using [Vercel](https://vercel.com):

1. Push your code to GitHub
2. Connect repository to Vercel
3. Add environment variables from `.env.local`
4. Deploy automatically

## ๐Ÿค Contributing

Contributions are welcome! Please:

1. Fork the repository
2. Create your 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

## ๐Ÿ“„ License

This project is licensed under the MIT License.

## ๐Ÿ”— Links

- **Linera Documentation**: [https://linera.dev](https://linera.dev)
- **Linera Discord**: [https://discord.gg/linera](https://discord.gg/linera)
- **Report Issues**: [GitHub Issues](https://github.com/YOUR_USERNAME/jeteeah/issues)

## ๐Ÿ™ Acknowledgments

Built with the [Linera Buildathon Template](https://github.com/linera-io/buildathon-template) and Next.js.

---

**Made with โค๏ธ for the Linera Blockchain**

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •