Skip to content

chenwenxiaolive/tetris

Repository files navigation

Tetris Game

A classic Tetris game built with Next.js and Supabase.

Features

  • User authentication (login/register)
  • Classic Tetris gameplay
  • Real-time score tracking
  • Global leaderboard (Top 10)
  • Each user keeps only their highest score

Tech Stack

  • Frontend: Next.js 16, React, TypeScript, Tailwind CSS
  • Backend: Supabase (Auth + Database)

Getting Started

  1. Clone the repository:
git clone https://github.com/chenwenxiaolive/tetris.git
cd tetris
  1. Install dependencies:
npm install
  1. Set up environment variables:
cp .env.example .env.local

Edit .env.local with your Supabase credentials:

NEXT_PUBLIC_SUPABASE_URL=your_supabase_url
NEXT_PUBLIC_SUPABASE_ANON_KEY=your_supabase_anon_key
  1. Run the development server:
npm run dev
  1. Open http://localhost:3000

Controls

Key Action
Left/Right Arrow Move piece
Up Arrow Rotate piece
Down Arrow Soft drop
Space Hard drop

Database Schema

CREATE TABLE scores (
  id UUID PRIMARY KEY,
  user_id UUID UNIQUE REFERENCES auth.users(id),
  username TEXT,
  score INTEGER,
  created_at TIMESTAMP
);

License

MIT

About

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •