A full-stack cricket match management application with real-time ball-by-ball commentary, comprehensive statistics, and admin controls.
- Features
- Tech Stack
- Project Structure
- Getting Started
- Authentication & Authorization
- API Documentation
- Database Schema
- Screenshots
- Contributing
- Match Management: Create and manage cricket matches with detailed information
- Ball-by-Ball Commentary: Real-time ball tracking with comprehensive statistics
- Team Management: Organize teams and player rosters
- Tournament System: Create and manage cricket tournaments
- Innings Tracking: Detailed innings-level data and analytics
- Player Profiles: Comprehensive player statistics and information
- Secure Authentication: Supabase-powered authentication with admin role management
- Protected Routes: Page-level and component-level access control
- Admin Dashboard: Dedicated admin controls for data management
- Edit Capabilities: Modify match data, balls, and statistics
- Modern Design: Sleek dark theme with gradient accents (orange-red-purple)
- Responsive Layout: Mobile-first design that works on all devices
- Real-time Updates: Live commentary and score updates
- Toast Notifications: User-friendly feedback for all actions
- Framework: Next.js 16 with React 19
- Language: TypeScript
- Styling: Tailwind CSS 4
- UI Components: Radix UI primitives
- Icons: Lucide React
- Authentication: Supabase Auth
- Notifications: React Hot Toast
- Framework: Spring Boot 3.3.4
- Language: Java 21
- Database: PostgreSQL
- ORM: Spring Data JPA
- Build Tool: Maven
- Dev Tools: Spring DevTools, Lombok
- Database: PostgreSQL (via Supabase)
- Authentication: Supabase Auth
- Storage: Supabase Storage
cricmate/
βββ backend/ # Spring Boot backend
β βββ src/
β β βββ main/
β β β βββ java/com/cricmate/
β β β β βββ controller/ # REST API controllers
β β β β βββ model/ # JPA entities
β β β β βββ repository/ # Data repositories
β β β β βββ service/ # Business logic
β β β βββ resources/
β β β βββ application.properties
β β βββ test/
β βββ pom.xml
β
βββ nextfront/ # Next.js frontend
β βββ src/
β β βββ app/ # App router pages
β β β βββ addmatch/ # Add match page
β β β βββ addplayer/ # Add player page
β β β βββ addteam/ # Add team page
β β β βββ addtournament/ # Add tournament page
β β β βββ addinnings/ # Add innings page
β β β βββ add-ball-by-ball/ # Ball-by-ball entry
β β β βββ admin/ # Admin authentication
β β β βββ matches/ # Match pages
β β β βββ players/ # Player pages
β β β βββ teams/ # Team pages
β β β βββ tournaments/ # Tournament pages
β β βββ components/ # React components
β β β βββ ui/ # Reusable UI components
β β β βββ Commentary.tsx # Ball-by-ball commentary
β β β βββ Scorecard.tsx # Match scorecard
β β β βββ MatchDetails.tsx # Match information
β β β βββ ...
β β βββ hooks/ # Custom React hooks
β β β βββ useIsAdmin.ts # Admin check hook
β β βββ lib/ # Utilities
β β β βββ supabaseClient.ts # Supabase config
β β β βββ utils.ts # Helper functions
β β βββ types/ # TypeScript types
β βββ public/ # Static assets
β βββ package.json
β
βββ README.md
- Node.js 20+ and npm
- Java 21+
- Maven 3.6+
- PostgreSQL database (or Supabase account)
-
Clone the repository
git clone https://github.com/MuhammadMustafa18/CricMateDbProject.git cd cricmate/backend -
Configure database
Create a
.envfile in thebackenddirectory:SPRING_DATASOURCE_URL=jdbc:postgresql://your-db-host:5432/your-db-name SPRING_DATASOURCE_USERNAME=your-username SPRING_DATASOURCE_PASSWORD=your-password
-
Run the backend
mvn spring-boot:run
The API will be available at
http://localhost:8080
-
Navigate to frontend directory
cd ../nextfront -
Install dependencies
npm install
-
Configure Supabase
Create a
.env.localfile:NEXT_PUBLIC_SUPABASE_URL=your-supabase-url NEXT_PUBLIC_SUPABASE_ANON_KEY=your-supabase-anon-key
-
Run the development server
npm run dev
The app will be available at
http://localhost:3000
Run the SQL schema to create the necessary tables:
teamsplayerstournamentsmatchesinningsballsprofiles(for admin management)
- Public Users: Can view matches, teams, players, and statistics
- Admin Users: Full access to create, edit, and delete data
- Create a user account via Supabase Auth
- In the
profilestable, setis_admin = truefor admin users - Admin users can access:
- All
/add*routes (addmatch, addplayer, addteam, etc.) - Ball-by-ball entry forms
- Edit buttons on commentary
- All
All admin routes use session-based authentication:
- Session check via Supabase
- Admin role verification from
profilestable - Toast notifications for unauthorized access
- Automatic redirects to login or home page
Use the useIsAdmin hook for conditional rendering:
import { useIsAdmin } from "@/hooks/useIsAdmin";
export default function MyComponent() {
const { isAdmin, loading } = useIsAdmin();
return (
<div>
{isAdmin && (
<button>Admin Only Action</button>
)}
</div>
);
}http://localhost:8080
GET /teams- Get all teamsGET /teams/{id}- Get team by IDGET /teams/full/{id}- Get team with playersPOST /teams/create- Create new team
GET /players- Get all playersGET /players/{id}- Get player by IDPOST /players- Create new player
GET /matches- Get all matchesGET /matches/{id}- Get match by IDGET /matches/full/{id}- Get match with full detailsPOST /matches- Create new match
GET /tournaments- Get all tournamentsGET /tournaments/{id}- Get tournament by IDGET /tournaments/{id}/matches- Get tournament matchesPOST /tournaments- Create new tournament
GET /innings- Get all inningsGET /innings/{id}- Get innings by IDPOST /innings- Create new innings
GET /balls- Get all ballsGET /balls/{id}- Get ball by IDPOST /balls- Create new ballPATCH /balls/{id}- Update ball
teams
team_id(PK)team_name
players
player_id(PK)player_namefull_namedate_of_birthbatting_stylebowling_styleplaying_role
matches
match_id(PK)team_a_id(FK)team_b_id(FK)tournament_id(FK)match_datematch_statematch_formatvenue
innings
innings_id(PK)match_id(FK)batting_team_id(FK)bowling_team_id(FK)
balls
ball_id(PK)innings_id(FK)over_numberball_numberbatsman_id(FK)bowler_id(FK)runswicket
profiles (Supabase)
id(PK, FK to auth.users)is_admin
Add screenshots of your application here
Contributions are welcome! Please follow these steps:
- Fork the repository
- Create a feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is open source and available under the MIT License.
Muhammad Mustafa
- GitHub: @MuhammadMustafa18
- Next.js team for the amazing framework
- Spring Boot for the robust backend framework
- Supabase for authentication and database services
- Radix UI for accessible component primitives
- Tailwind CSS for the utility-first CSS framework
Built with β€οΈ for cricket enthusiasts