A full-stack dynamic Cricket Web Application that manages cricket matches, dynamic teams, player statistics, and match history. Built with React, Node.js, Express, and Supabase.
This web application was built using a prompt-engineering-first approach:
- ๐ก Idea + Prompts refined using ChatGPT
- ๐ง Initial code generation through bolt.new
- ๐ง Final development and refinement using Cursor AI, Google Gemini, ChatGPT
The project combines human creativity with AI-augmented development. All logic, decisions, and final code were reviewed and customized as needed.
- Player & Team Management: Add global players and create dynamic teams
- Match Flow: Complete match tracking with toss, innings, scores, and wickets
- Automatic Winner Detection: System determines winner and Man of the Match
- Rematch Feature: Reuse teams for new matches
- Player Statistics: Comprehensive player stats tracking
- Match History: Complete match history with filtering options
- Responsive Design: Mobile-first responsive UI
- Frontend: React + TypeScript + Tailwind CSS
- Backend: Node.js + Express
- Database: Supabase (PostgreSQL)
- State Management: React Context API (Frontend)
- Date Utility: Day.js
- Build Tool: Vite
CricketManagementApp/
โโโ frontend/ # ๐จ React Frontend Application
โ โโโ src/ # Source code
โ โ โโโ components/ # React components
โ โ โโโ context/ # State management
โ โ โโโ lib/ # Utilities
โ โ โโโ types/ # TypeScript types
โ โ โโโ App.tsx # Main app component
โ โโโ package.json # Frontend dependencies
โ โโโ vite.config.ts # Vite configuration
โ
โโโ backend/ # โ๏ธ Node.js Backend Server
โ โโโ index.js # Main server file
โ โโโ package.json # Backend dependencies
โ โโโ .env # Backend environment
โ
โโโ package.json # ๐ฏ Root package.json (manages both)
โโโ README.md # ๐ This file
- Node.js: v16 or higher.
- npm: (comes with Node.js).
- Supabase Account: A free account at supabase.com.
Run this command from the root CricketManagementApp/
directory to install dependencies for both the frontend and backend.
# If you have a root package.json with an "install:all" script:
npm run install:all
# Otherwise, install for each part manually:
cd frontend && npm install
cd ../backend && npm install
cd ..
- Create a MySQL database:
CREATE DATABASE cricket_management;
- The database tables will be automatically created when you start the server.
The setup script creates these environment files automatically:
Frontend (frontend/.env):
VITE_API_URL=http://localhost:5000/api
Backend (backend/.env):
PORT=5000
DB_HOST=localhost
DB_USER=root
DB_PASSWORD=
DB_NAME=cricket_management
NODE_ENV=development
# Start both frontend and backend simultaneously
npm run dev
Open your browser and navigate to http://localhost:5173
npm run dev # Start development server
npm run build # Build for production
npm run preview # Preview production build
npm run dev # Start development server
npm start # Start production server
GET /api/players
- Get all playersPOST /api/players
- Add new playerGET /api/players/:id
- Updates an Existing player's nameDELETE /api/players/:id
- Deletes a player by their IDGET /api/players/stats/:id
- Retrieves career statistics for a single player by their ID.GET /api/players/stats/all
- Retrieves career statistics for all players
GET /api/matches
- Get all matchesGET /api/matches/:id
- Get match by IDPOST /api/matches
- Save new matchGET /api/matches/:id/stats
- Get match player stats
The database schema is automatically created and maintained by the backend server on startup. The following SQL statements represent the current structure of the tables.
CREATE TABLE IF NOT EXISTS players (
id VARCHAR(36) PRIMARY KEY,
name VARCHAR(255) NOT NULL UNIQUE,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
CREATE TABLE IF NOT EXISTS matches (
id VARCHAR(36) PRIMARY KEY DEFAULT (UUID()),
team_a_name VARCHAR(255) NOT NULL,
team_b_name VARCHAR(255) NOT NULL,
overs INT NOT NULL,
toss_winner VARCHAR(255),
toss_decision VARCHAR(10),
team_a_score INT DEFAULT 0,
team_a_wickets INT DEFAULT 0,
team_b_score INT DEFAULT 0,
team_b_wickets INT DEFAULT 0,
winner VARCHAR(255),
man_of_match VARCHAR(255),
match_date DATE DEFAULT (CURRENT_DATE),
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
CREATE TABLE IF NOT EXISTS match_player_stats (
id VARCHAR(36) PRIMARY KEY DEFAULT (UUID()),
match_id VARCHAR(36),
player_id VARCHAR(36),
team VARCHAR(255),
runs INT DEFAULT 0,
wickets INT DEFAULT 0,
ones INT DEFAULT 0,
twos INT DEFAULT 0,
threes INT DEFAULT 0,
fours INT DEFAULT 0,
sixes INT DEFAULT 0,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (match_id) REFERENCES matches(id) ON DELETE CASCADE,
FOREIGN KEY (player_id) REFERENCES players(id) ON DELETE CASCADE
);
- Add Players: Navigate to Player Management to add players to the global pool
- Create Match: Use Match Setup to create a new match with teams and settings
- Play Match: Follow the match flow to record scores and wickets
- View History: Check Match History to see all completed matches
- Player Stats: View comprehensive player statistics
- Make sure MySQL is running
- Check your database credentials in
backend/.env
- Verify the database
cricket_management
exists
- โ Player management (add, view, search)
- โ Dynamic team creation
- โ Match setup with toss and overs
- โ Live match tracking with innings
- โ Automatic winner detection
- โ Man of the Match calculation
- โ Match history with filtering
- โ Player statistics tracking
- โ Rematch functionality
- โ Responsive mobile-first design