Make your events more fun
Client:
Server:
Feedback are welcome! Feel free to open an issue or a pull request on the GitHub repository.
You will need to have Bun installed.
Clone the project
git clone https://github.com/GautierPicon/Bingo
Go to the project directory
cd bingo
Install dependencies
bun install
Start the server
bun run dev
Add a .env.local file based on this template and replace the variables with your own
PUBLIC_SUPABASE_URL=https://***.supabase.co
PUBLIC_SUPABASE_PUBLISHABLE_DEFAULT_KEY=sb_publishable_***
In SQL Editor, create this query and run it
-- Enable UUID extension
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
-- Rooms table
CREATE TABLE rooms (
id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
code VARCHAR(6) UNIQUE NOT NULL,
use_star BOOLEAN DEFAULT false,
status VARCHAR DEFAULT 'waiting',
winner_id UUID
);
-- Players table
CREATE TABLE players (
id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
room_id UUID NOT NULL REFERENCES rooms(id) ON DELETE CASCADE,
name VARCHAR NOT NULL,
is_host BOOLEAN DEFAULT false,
profile_picture VARCHAR,
joined_at TIMESTAMP DEFAULT NOW()
);
-- Grids table
CREATE TABLE grids (
id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
room_id UUID NOT NULL REFERENCES rooms(id) ON DELETE CASCADE,
player_id UUID NOT NULL REFERENCES players(id) ON DELETE CASCADE,
cells JSONB NOT NULL
);
-- Add winner foreign key
ALTER TABLE rooms ADD CONSTRAINT fk_winner FOREIGN KEY (winner_id) REFERENCES players(id) ON DELETE SET NULL;
-- Enable realtime
ALTER PUBLICATION supabase_realtime ADD TABLE rooms;
ALTER PUBLICATION supabase_realtime ADD TABLE players;
ALTER PUBLICATION supabase_realtime ADD TABLE grids;