Skip to content

suryanshsingh07/PlaySphere

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

11 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

PlaySphere Badge

๐ŸŸ๏ธ PlaySphere

Agentic AI Sports Infrastructure Discovery & Booking Platform

Your Intelligent Sports Copilot โ€” Find, Compare & Book Courts Using Natural Language

Vercel Live Demo Netlify Live Demo

๐ŸŒ Vercel Link: https://aiplaysphere.vercel.app/
๐ŸŒ Netlify Link: https://aiplaysphere.netlify.app/

Problem โ€ข Solution โ€ข Architecture โ€ข AI Agents โ€ข Features โ€ข Tech Stack โ€ข Database โ€ข API Docs โ€ข Installation โ€ข Demo


๐ŸŽฏ Problem Statement

Organizing a game of football, badminton, or cricket is a fragmented, frustrating experience:

  • ๐Ÿ” Players manually search across multiple platforms and messaging groups for available venues
  • ๐Ÿ“ž Coordination requires endless calls to venue managers to verify open slots
  • ๐Ÿ’ฐ No transparent pricing โ€” players can't easily compare rates or find budget-friendly options
  • ๐Ÿ—บ๏ธ No unified geographic search โ€” discovering nearby facilities requires trial and error
  • ๐Ÿ“Š Venue owners lack data-driven tools to optimize pricing, track demand, or manage bookings efficiently

The sports infrastructure discovery and booking pipeline is broken โ€” it needs an intelligent, agentic solution.

The Gap We're Solving

graph LR
subgraph BEFORE["โŒ Current Experience"]
B1[Search WhatsApp Groups] --> B2[Call 5+ Venues]
B2 --> B3[Check Availability Manually]
B3 --> B4[Negotiate Pricing]
B4 --> B5[Hope for Confirmation]
end

subgraph AFTER["โœ… With PlaySphere"]
A1["'Book badminton 7 PM Gomti Nagar'"] --> A2["AI Parses โ†’ Searches โ†’ Books"]
A2 --> A3["โœ… Confirmed in Seconds"]
end

BEFORE -.->|"PlaySphere Replaces"| AFTER

style BEFORE fill:#1a0000,stroke:#ef4444,color:#fca5a5
style AFTER fill:#001a0e,stroke:#10b981,color:#6ee7b7
Loading

๐Ÿ’ก Solution Overview

PlaySphere is a full-stack, AI-powered sports venue discovery and booking platform that combines:

Capability Description
๐Ÿค– AI Sports Copilot A conversational agentic AI that parses natural language queries, searches venues, compares prices, and books courts autonomously
๐Ÿ—บ๏ธ Interactive Geo Map Real-time dark-themed Leaflet map with venue markers, area density overlays, and one-click booking popups
โšก Real-Time Booking Engine Live slot availability with Socket.IO push updates, conflict detection, and instant confirmation
๐Ÿ“ˆ Smart Pricing Agent Demand-aware dynamic pricing suggestions: peak hour surcharges, rainy day discounts, last-minute offers
๐Ÿ“Š Venue Owner Dashboard Business intelligence portal with SVG revenue charts, donut sport breakdowns, AI booking share metrics, sparkline trends, and customer reviews
๐Ÿ” Role-Based Access JWT-secured authentication with three roles: Player, Venue Owner, and Platform Admin

๐Ÿ† What Makes PlaySphere Unique

User says: "Book badminton tomorrow 7 PM near Gomti Nagar under โ‚น500"

PlaySphere AI Copilot:
โ”œโ”€โ”€ ๐Ÿ” Parses intent โ†’ Sport: badminton, Date: tomorrow, Time: 19:00, Area: Gomti Nagar, Budget: โ‚น500
โ”œโ”€โ”€ ๐ŸŸ๏ธ Queries database with geospatial + sport + price filters
โ”œโ”€โ”€ โšก Checks real-time slot availability across matching venues
โ”œโ”€โ”€ โœ… Books the best available court automatically
โ””โ”€โ”€ ๐Ÿ“ฑ Returns confirmation with venue details, price, and time

Result: TRUE AGENTIC AI โ€” from natural language to confirmed booking in one step

๐Ÿ“ Architecture

System Architecture Diagram

graph TB
subgraph Client["๐Ÿ–ฅ๏ธ Frontend โ€” React 18 + Vite"]
UI[Premium Glassmorphism UI]
MAP[Leaflet Dark Map Engine]
CHAT[AI Chat Widget]
BOOK[Booking Interface]
DASH[SVG Analytics Dashboard]
end

subgraph Server["โš™๏ธ Backend โ€” Express + Socket.IO"]
API[REST API Gateway]
AUTH[JWT Auth Middleware]
RT[Real-Time Engine]
ADAPT[Mongoose-Compatible Adapter]
end

subgraph Agents["๐Ÿค– AI Agent Layer"]
NLP[NLP Intent Parser]
REC[Recommendation Agent]
PRICE[Dynamic Pricing Agent]
DEMAND[Demand Prediction Agent]
end

subgraph Data["๐Ÿ—„๏ธ Data Layer โ€” Firebase / Local JSON"]
USERS[(Users Collection)]
VENUES[(Venues + GeoJSON Index)]
BOOKINGS[(Bookings Collection)]
REVIEWS[(Reviews Collection)]
end

Client -->|HTTP/WS| Server
Server -->|Query/Mutate| Data
Server -->|Invoke| Agents
Agents -->|Read/Write| Data
RT -->|Push Updates| Client
Loading

Request Lifecycle โ€” End-to-End Data Flow

flowchart LR
A["๐Ÿƒ User Action"] --> B["๐ŸŒ React Frontend"]
B -->|Axios HTTP| C["โš™๏ธ Express Router"]
C --> D{"๐Ÿ” JWT Auth?"}
D -->|Valid| E["๐Ÿ“‹ Route Handler"]
D -->|Invalid| F["โŒ 401 Unauthorized"]
E --> G["๐Ÿ—„๏ธ Database Adapter"]
G -->|Firebase Set?| H["โ˜๏ธ Firestore"]
G -->|No Credentials| I["๐Ÿ“ localDb.json"]
H --> J["๐Ÿ“จ Response"]
I --> J
J -->|JSON| B
E -->|Booking Created?| K["โšก Socket.IO Emit"]
K -->|Real-Time Push| B

style A fill:#0d2137,stroke:#06b6d4,color:#67e8f9
style H fill:#1a1040,stroke:#8b5cf6,color:#c4b5fd
style I fill:#0a1628,stroke:#10b981,color:#6ee7b7
style K fill:#1a0d28,stroke:#ec4899,color:#f9a8d4
Loading

๐Ÿค– AI Agent Workflow

Agentic Copilot โ€” End-to-End Flow

sequenceDiagram
actor Player as ๐Ÿƒ Athlete
participant Chat as ๐Ÿ’ฌ Chat Widget
participant NLP as ๐Ÿง  NLP Intent Parser
participant Search as ๐Ÿ” Venue Search Agent
participant Book as ๐Ÿ“… Booking Agent
participant DB as ๐Ÿ—„๏ธ Database
participant Notify as โšก Socket.IO

Player->>Chat: "Book badminton tomorrow 7 PM near Gomti Nagar"
Chat->>NLP: POST /api/ai/chat

rect rgb(15, 23, 42)
Note over NLP: ๐Ÿค– AI Agent Processing Pipeline
NLP->>NLP: Extract entities (sport, date, time, location, budget)
NLP->>Search: Build geospatial + filter query
Search->>DB: Find venues matching sport, area, price
DB-->>Search: Return matched venues (sorted by rating)
Search->>Search: Apply budget filter & rank results
end

alt โœ… Slot Available
Search->>Book: Top venue selected, create booking
Book->>DB: Create booking with status "confirmed"
DB-->>Book: Booking confirmed
Book->>Notify: Emit "booking:new" event
Notify-->>Player: Real-time confirmation
Book-->>Chat: "โœ… Booked at Gomti Nagar Sports Arena, 7:00 PM, โ‚น400"
else โŒ No Slots
Search-->>Chat: Return alternative venues with available times
Chat-->>Player: Render inline venue suggestion cards
end
Loading

Multi-Agent System Architecture

graph LR
subgraph Agents["๐Ÿค– PlaySphere AI Agents"]
A1[๐Ÿ” Discovery Agent<br/>Venue search & filtering]
A2[๐Ÿ“… Booking Agent<br/>Slot reservation & conflicts]
A3[๐Ÿ’ฐ Pricing Agent<br/>Dynamic pricing optimization]
A4[โญ Recommendation Agent<br/>Personalized suggestions]
A5[๐Ÿ“Š Demand Agent<br/>Trend prediction & analytics]
end

A1 --> A2
A1 --> A4
A3 --> A2
A5 --> A3
A5 --> A4
Loading
Agent Role Input Output
Discovery Agent Searches venues by sport, location, price, and amenities User query + filters Ranked venue list
Booking Agent Handles slot availability, conflict detection, and reservation Venue + time + user Confirmed booking
Pricing Agent Generates peak/off-peak/weekend pricing recommendations Venue bookings data Pricing matrix
Recommendation Agent Scores venues based on user preferences and play history User profile + venues Scored recommendations
Demand Agent Predicts trending sports, peak hours, and busiest days Aggregate booking data Demand insights

NLP Intent Parsing Pipeline

flowchart TD
INPUT["๐Ÿ’ฌ User Message"] --> LOWER["๐Ÿ”ก Normalize & Lowercase"]
LOWER --> S{"๐Ÿ… Sport\nDetected?"}
S -->|Yes| SPORT["football / badminton / cricket..."]
S -->|No| DEFAULT["Use user preferences"]

LOWER --> L{"๐Ÿ“ Location\nDetected?"}
L -->|Yes| LOC["Extract area name"]
L -->|No| GEOLOC["Use GPS coordinates"]

LOWER --> T{"๐Ÿ• Time\nDetected?"}
T -->|Yes| TIME["Parse hour โ†’ HH:00"]
T -->|No| NEXTSLOT["Find next available"]

LOWER --> D{"๐Ÿ“… Date\nDetected?"}
D -->|Yes| DATE["today / tomorrow / specific date"]
D -->|No| TODAY["Default: today"]

LOWER --> B{"๐Ÿ’ฐ Budget\nDetected?"}
B -->|Yes| BUDGET["Extract max price"]
B -->|No| NOBUDGET["No price filter"]

SPORT --> INTENT["๐ŸŽฏ Structured Intent"]
DEFAULT --> INTENT
LOC --> INTENT
GEOLOC --> INTENT
TIME --> INTENT
NEXTSLOT --> INTENT
DATE --> INTENT
TODAY --> INTENT
BUDGET --> INTENT
NOBUDGET --> INTENT

INTENT --> CLASSIFY{"๐Ÿค– Intent\nClassification"}
CLASSIFY -->|book / find| SEARCH["๐Ÿ” Search + Book"]
CLASSIFY -->|recommend| RECOMMEND["โญ Recommendations"]
CLASSIFY -->|demand / trends| ANALYTICS["๐Ÿ“Š Demand Insights"]
CLASSIFY -->|schedule| SCHEDULE["๐Ÿ“… My Bookings"]
CLASSIFY -->|help / greeting| HELP["๐Ÿ’ก Help Response"]

style INPUT fill:#0d2137,stroke:#06b6d4,color:#67e8f9
style INTENT fill:#1a1040,stroke:#8b5cf6,color:#c4b5fd
style CLASSIFY fill:#0a1628,stroke:#f59e0b,color:#fcd34d
Loading

โœจ Features

๐Ÿƒ For Athletes (Players)

Feature Description
๐Ÿค– AI Sports Copilot Natural language chat to find and book venues โ€” "Find football turf for 8 players under โ‚น1200 near Chinhat"
๐Ÿ—บ๏ธ Live Venue Map Dark-themed interactive Leaflet map with custom markers, area popups, and venue density visualization
๐Ÿ” Smart Filters Filter by sport, area, rating, price range, and sort by popularity or distance
๐Ÿ“… Instant Slot Booking Interactive time grid showing real-time availability with one-click reservation
โญ Venue Reviews Rate and review venues with star ratings and written feedback
๐Ÿ“‹ Booking History Track upcoming games and past reservations with cancel/refund support
๐Ÿ’ก AI Recommendations Personalized venue suggestions based on preferred sports and play history
๐Ÿท๏ธ Price Comparison View and compare prices across multiple venues at a glance

๐Ÿข For Venue Owners

Feature Description
๐Ÿ“Š Analytics Dashboard SVG-rendered revenue bar charts, donut sport breakdown, sparkline trends, and KPI stat cards
๐Ÿ’ฐ AI Dynamic Pricing Automated pricing recommendations for peak hours, weekends, rainy days, and last-minute slots
๐Ÿ“ˆ Demand Prediction Trending sports, peak hours analysis, and day-wise demand forecasting
๐Ÿ‘ฅ Customer Management View all bookings, user details, and booking sources (manual vs AI-booked)
๐Ÿง  AI Insights Panel Actionable business intelligence โ€” weekend surge alerts, off-peak opportunity tips, adoption metrics
๐Ÿ“‰ Revenue Breakdown Month-over-month comparison tables with per-booking averages and share percentages
๐Ÿ† Sport Performance Ranked sport leaderboard with booking counts, revenue, and progress bars
๐Ÿ”„ Real-Time Updates Live booking feed with instant status changes and source tracking

๐Ÿ›ก๏ธ Platform Features

Feature Description
๐Ÿ” JWT Authentication Secure token-based auth with role-based access control (Player / Owner / Admin)
โšก Real-Time Updates Socket.IO powered live booking notifications and slot status changes
๐ŸŒ Geospatial Queries Haversine distance calculation for proximity-based venue search
๐ŸŽจ Premium Dark UI Glassmorphism design with 12+ custom animations, gradient accents, and responsive layouts
๐Ÿ“ฑ Mobile Responsive Fully responsive across desktop, tablet, and mobile devices
๐Ÿฆถ Professional Footer Multi-column footer with brand info, sport tags, platform links, social icons, and feature badges
๐Ÿ”ฅ Firebase-Ready Firestore integration with graceful local JSON fallback for zero-dependency demos
๐Ÿ“Š Inline SVG Charts Zero-dependency bar charts, donut charts, and sparkline trends rendered as pure SVG

๐Ÿ—„๏ธ Database Design

Entity Relationship Diagram

erDiagram
USER ||--o{ BOOKING : "creates"
USER ||--o{ REVIEW : "writes"
USER ||--o{ VENUE : "owns"
VENUE ||--o{ BOOKING : "hosts"
VENUE ||--o{ REVIEW : "receives"
VENUE }|--|| SPORT_CONFIG : "offers"

USER {
string _id PK
string username UK
string email UK
string password
string role "user | venue_owner | admin"
string phone
object location "GeoJSON Point"
array preferredSports
string skillLevel
}

VENUE {
string _id PK
string name
string description
string address
string area
string city
object location "GeoJSON Point"
array sports "SportConfig[]"
array amenities
ref owner FK "โ†’ User"
float rating "0โ€“5"
int totalReviews
object operatingHours
boolean isActive
}

BOOKING {
string _id PK
ref user FK "โ†’ User"
ref venue FK "โ†’ Venue"
string sport
int court
date date
string startTime
string endTime
float totalPrice
string status "pending | confirmed | cancelled | completed"
string paymentStatus
boolean isAgentBooked
}

REVIEW {
string _id PK
ref user FK "โ†’ User"
ref venue FK "โ†’ Venue"
int rating "1โ€“5"
string comment
}

SPORT_CONFIG {
string name
int courts
float pricePerHour
int maxPlayers
}
Loading

Database Adapter Architecture

PlaySphere uses a Mongoose-compatible adapter (mongooseMock.js) that provides a unified interface for both Firebase Firestore and a local JSON database:

flowchart TB
subgraph Models["๐Ÿ“ฆ Mongoose-Style Models"]
U[User.js]
V[Venue.js]
B[Booking.js]
R[Review.js]
end

subgraph Adapter["๐Ÿ”„ Database Adapter โ€” mongooseMock.js"]
SCHEMA["Schema Definition<br/>fields, hooks, methods, statics"]
QE["Query Engine<br/>find, findOne, aggregate, populate"]
FILTER["In-Memory Filter<br/>$regex, $gte, $lte, $in, $or, $near, $text"]
HOOKS["Lifecycle Hooks<br/>pre/post save, deleteOne"]
end

subgraph Storage["๐Ÿ’พ Storage Backend"]
FB["โ˜๏ธ Firebase Firestore<br/>(if credentials provided)"]
LJ["๐Ÿ“ localDb.json<br/>(zero-dependency fallback)"]
end

Models -->|"require('./mongooseMock')"| Adapter
Adapter -->|"FIREBASE_PROJECT_ID set?"| FB
Adapter -->|"No credentials"| LJ

style Adapter fill:#1a1040,stroke:#8b5cf6,color:#c4b5fd
style FB fill:#1a0d00,stroke:#f59e0b,color:#fcd34d
style LJ fill:#001a0e,stroke:#10b981,color:#6ee7b7
Loading

Supported Query Operators:

Operator Description Example
$regex Pattern matching with flags { area: { $regex: 'gomti', $options: 'i' } }
$gte / $lte Range comparisons { rating: { $gte: 4.0 } }
$in Match any value in array { status: { $in: ['confirmed', 'completed'] } }
$or Logical OR across conditions { $or: [{ area: /gomti/i }, { name: /gomti/i }] }
$near Geospatial proximity (Haversine) { location: { $near: { $geometry: { coordinates: [80.9, 26.8] } } } }
$text Full-text search across fields { $text: { $search: 'badminton court' } }
$sum / $avg Aggregation operators { $group: { _id: '$sport', total: { $sum: '$totalPrice' } } }

๐Ÿ› ๏ธ Tech Stack

Layer Technology Purpose
Frontend React 18 + Vite Component-based SPA with hot module replacement
Routing React Router DOM v6 Client-side navigation with protected routes
Maps Leaflet + React Leaflet Interactive dark-themed map with CartoDB tiles
Charts Inline SVG Zero-dependency bar charts, donut charts, sparkline trends
Icons Lucide React Premium icon library (350+ icons)
HTTP Client Axios API communication with interceptors
Styling Vanilla CSS Custom design system with CSS variables, glassmorphism, animations
Backend Node.js + Express RESTful API server with middleware architecture
Database Firebase Firestore / Local JSON Cloud-native document storage with local fallback
DB Adapter Custom Mongoose Mock Mongoose-compatible API for seamless model usage
Auth JWT + bcryptjs Stateless authentication with password hashing
Real-Time Socket.IO Bidirectional WebSocket communication
AI Engine Custom NLP Parser Rule-based intent extraction for sports queries

Tech Stack Visualization

graph TB
subgraph FE["๐ŸŽจ Frontend Stack"]
REACT["โš›๏ธ React 18"]
VITE["โšก Vite"]
LEAFLET["๐Ÿ—บ๏ธ Leaflet Maps"]
SVG["๐Ÿ“Š SVG Charts"]
CSS["๐ŸŽจ Glassmorphism CSS"]
LUCIDE["โœจ Lucide Icons"]
AXIOS["๐Ÿ“ก Axios"]
end

subgraph BE["โš™๏ธ Backend Stack"]
NODE["๐Ÿ’š Node.js"]
EXPRESS["๐Ÿš‚ Express"]
SOCKETIO["โšก Socket.IO"]
JWT["๐Ÿ” JWT"]
BCRYPT["๐Ÿ”’ bcryptjs"]
end

subgraph DB["๐Ÿ—„๏ธ Data Stack"]
FIREBASE["๐Ÿ”ฅ Firebase Firestore"]
LOCALJSON["๐Ÿ“ Local JSON"]
ADAPTER["๐Ÿ”„ Mongoose Adapter"]
end

subgraph AI["๐Ÿค– AI Stack"]
NLP_["๐Ÿง  NLP Parser"]
PRICING_["๐Ÿ’ฐ Pricing Agent"]
DEMAND_["๐Ÿ“Š Demand Agent"]
REC_["โญ Rec Agent"]
end

FE <-->|REST API| BE
BE <-->|Read/Write| DB
BE --> AI
BE <-->|WebSocket| FE

style FE fill:#0d2137,stroke:#06b6d4,color:#67e8f9
style BE fill:#0a1628,stroke:#10b981,color:#6ee7b7
style DB fill:#1a0d00,stroke:#f59e0b,color:#fcd34d
style AI fill:#1a1040,stroke:#8b5cf6,color:#c4b5fd
Loading

๐Ÿ“‚ Project Structure

PlaySphere/
โ”‚
โ”œโ”€โ”€ backend/ # โš™๏ธ Express API Server
โ”‚ โ”œโ”€โ”€ config/
โ”‚ โ”‚ โ”œโ”€โ”€ db.js # Database connection initializer
โ”‚ โ”‚ โ””โ”€โ”€ mongooseMock.js # ๐Ÿ”ฅ Mongooseโ†’Firebase/JSON adapter (800+ lines)
โ”‚ โ”œโ”€โ”€ middleware/
โ”‚ โ”‚ โ””โ”€โ”€ authMiddleware.js # JWT verification + role authorization
โ”‚ โ”œโ”€โ”€ models/
โ”‚ โ”‚ โ”œโ”€โ”€ User.js # User schema (bcrypt hashing, roles, preferences)
โ”‚ โ”‚ โ”œโ”€โ”€ Venue.js # Venue schema (GeoJSON, sports config, amenities)
โ”‚ โ”‚ โ”œโ”€โ”€ Booking.js # Booking schema (conflict detection, pricing)
โ”‚ โ”‚ โ””โ”€โ”€ Review.js # Review schema (star ratings, auto avg calculation)
โ”‚ โ”œโ”€โ”€ routes/
โ”‚ โ”‚ โ”œโ”€โ”€ authRoutes.js # Register, Login, Profile endpoints
โ”‚ โ”‚ โ”œโ”€โ”€ venueRoutes.js # CRUD + geospatial search + slot availability
โ”‚ โ”‚ โ”œโ”€โ”€ bookingRoutes.js # Create, list, cancel bookings
โ”‚ โ”‚ โ”œโ”€โ”€ aiRoutes.js # ๐Ÿค– AI Copilot chat + recommendations + pricing
โ”‚ โ”‚ โ””โ”€โ”€ analyticsRoutes.js # Dashboard stats, heatmap data, platform metrics
โ”‚ โ”œโ”€โ”€ seed/
โ”‚ โ”‚ โ””โ”€โ”€ seedData.js # 15 Lucknow venues, 5 users, 30 bookings, reviews
โ”‚ โ”œโ”€โ”€ localDb.json # ๐Ÿ“ Auto-generated local database (fallback)
โ”‚ โ”œโ”€โ”€ server.js # App bootstrap, Socket.IO, middleware, error handling
โ”‚ โ”œโ”€โ”€ .env.example # Environment variable template
โ”‚ โ””โ”€โ”€ package.json
โ”‚
โ”œโ”€โ”€ frontend/ # ๐Ÿ–ฅ๏ธ React + Vite Client
โ”‚ โ”œโ”€โ”€ public/
โ”‚ โ”‚ โ””โ”€โ”€ favicon.svg # PlaySphere gradient favicon
โ”‚ โ”œโ”€โ”€ src/
โ”‚ โ”‚ โ”œโ”€โ”€ components/
โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ Navbar.jsx # Glassmorphism header with mobile drawer
โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ Footer.jsx # ๐Ÿฆถ Multi-column footer with social & feature badges
โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ MapView.jsx # Leaflet dark map with custom DivIcon markers
โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ VenueCard.jsx # Glass card with sports tags, ratings, pricing
โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ BookingModal.jsx # Slot grid picker, date selector, price calculator
โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ AIChatbot.jsx # ๐Ÿค– Floating AI chat with suggestion prompts
โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ StatsCard.jsx # Animated counter with gradient values
โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ FeatureCard.jsx # Feature showcase with hover glow effects
โ”‚ โ”‚ โ”œโ”€โ”€ pages/
โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ Home.jsx # Hero section, stats, features, CTA
โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ Explore.jsx # Split layout: filters + map + venue grid
โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ VenueDetail.jsx # Sport tabs, amenities, reviews, mini-map
โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ Bookings.jsx # Upcoming/past tabs with cancel actions
โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ Dashboard.jsx # ๐Ÿ“Š Enhanced: SVG charts, donut, sparklines, AI insights
โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ Auth.jsx # Login/Register with role selection + demo buttons
โ”‚ โ”‚ โ”œโ”€โ”€ App.jsx # Route definitions + AuthContext + Footer
โ”‚ โ”‚ โ”œโ”€โ”€ index.css # ๐ŸŽจ Complete design system (600+ lines)
โ”‚ โ”‚ โ””โ”€โ”€ main.jsx # React root with BrowserRouter
โ”‚ โ”œโ”€โ”€ index.html # SEO tags, Google Fonts, Leaflet CSS
โ”‚ โ”œโ”€โ”€ vite.config.js # API proxy to backend
โ”‚ โ””โ”€โ”€ package.json
โ”‚
โ”œโ”€โ”€ .gitignore
โ””โ”€โ”€ README.md # ๐Ÿ“– This file

๐Ÿ“‹ API Documentation

๐Ÿ” Authentication (/api/auth)

Method Endpoint Access Description
POST /register Public Create new account (Player or Venue Owner)
POST /login Public Authenticate and receive JWT token
GET /me Private Get current user profile

๐ŸŸ๏ธ Venues (/api/venues)

Method Endpoint Access Description
GET / Public List venues with filters (sport, area, minPrice, maxPrice, minRating, sort)
GET /nearby?lat=&lng=&radius= Public Geospatial proximity search
GET /:id Public Venue detail with reviews
GET /:id/slots?date=&sport= Public Available time slots for a specific date
POST / Owner Create new venue
PUT /:id Owner Update venue details
POST /:id/reviews Private Submit star rating and comment

๐Ÿ“… Bookings (/api/bookings)

Method Endpoint Access Description
POST / Private Reserve a court slot (conflict detection included)
GET /my Private Get user's booking history
PUT /:id/cancel Private Cancel booking and trigger refund
GET /venue/:venueId Owner View bookings for owned venue

๐Ÿค– AI Agents (/api/ai)

Method Endpoint Access Description
POST /chat Private AI Sports Copilot โ€” natural language venue search + booking
GET /recommendations Private Personalized venue suggestions based on user preferences
GET /demand-prediction Public Trending sports, peak hours, busiest days
GET /dynamic-pricing/:venueId Owner AI pricing matrix (peak, off-peak, weekend, rainy day)

๐Ÿ“Š Analytics (/api/analytics)

Method Endpoint Access Description
GET /dashboard Owner Revenue, bookings, ratings, AI booking share, monthly trends
GET /heatmap Public Venue coordinates with crowd density for map overlay
GET /stats Public Platform-wide aggregate statistics

API Request Flow

sequenceDiagram
participant C as ๐Ÿ–ฅ๏ธ Client
participant A as ๐Ÿ” Auth Middleware
participant R as ๐Ÿ“‹ Router
participant D as ๐Ÿ—„๏ธ Database
participant S as โšก Socket.IO

C->>R: POST /api/bookings
R->>A: Verify JWT Token
A-->>R: โœ… User Authenticated
R->>D: Check slot availability
D-->>R: Slot is free
R->>D: Create booking document
D-->>R: Booking saved
R->>S: Emit 'booking:new'
S-->>C: Real-time notification
R-->>C: 201 { success: true, booking }
Loading

๐Ÿš€ Installation

Prerequisites

  • Node.js (v18+) โ€” Download
  • Firebase (optional) โ€” Firebase Console
  • The app works without Firebase using a local JSON database fallback

Step 1: Clone the Repository

git clone https://github.com/your-username/PlaySphere.git
cd PlaySphere

Step 2: Configure Backend Environment

cd backend
cp .env.example .env

Edit .env with your configuration:

PORT=5000
JWT_SECRET=your_secure_secret_key
JWT_EXPIRE=30d
CLIENT_URL=http://localhost:5173

# Firebase Configuration (leave blank to use local JSON database)
FIREBASE_PROJECT_ID=
FIREBASE_CLIENT_EMAIL=
FIREBASE_PRIVATE_KEY=

๐Ÿ’ก No Firebase? That's fine! Leave the Firebase fields blank and PlaySphere will use localDb.json automatically.

Step 3: Install & Seed Backend

npm install
npm run seed # Seeds 15 Lucknow venues, 5 users, 30 bookings, reviews
npm run dev # Starts Express server on port 5000

Expected seed output:

โš ๏ธ Firebase credentials not provided. Falling back to local JSON Database
โœจ PlaySphere Database Adapter Loaded (Firebase Firestore / Local Fallback Active)
๐ŸŒฑ Starting PlaySphere database seed...
๐Ÿ—‘๏ธ Cleared existing data
โœ… Created 5 users
โœ… Created 15 venues in Lucknow
โœ… Created 12 reviews
โœ… Created 30 sample bookings

โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
๐ŸŽ‰ PlaySphere seed complete!

๐Ÿ“‹ Demo Credentials:
Admin: admin@playsphere.in / admin123
Venue Owner: rahul@playsphere.in / password123
Player: arjun@playsphere.in / password123
โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•

Step 4: Install & Run Frontend

Open a new terminal:

cd frontend
npm install
npm run dev # Starts Vite dev server on port 5173

Step 5: Open in Browser

Navigate to http://localhost:5173 ๐Ÿš€


๐Ÿ”‘ Demo Credentials

Role Email Password Access
๐Ÿƒ Player arjun@playsphere.in password123 Explore, Book, AI Chat, Reviews
๐Ÿข Venue Owner rahul@playsphere.in password123 Dashboard, Analytics, Pricing
๐Ÿ›ก๏ธ Admin admin@playsphere.in admin123 Full platform access

๐Ÿ—บ๏ธ Seeded Venues (Lucknow)

The database ships with 15 premium sports venues across Lucknow:

# Venue Area Sports Rating
1 Gomti Nagar Sports Arena Gomti Nagar Badminton, Table Tennis, Squash โญ 4.7
2 Hazratganj Cricket Ground Hazratganj Cricket โญ 4.5
3 Indira Nagar Football Hub Indira Nagar Football, Volleyball โญ 4.8
4 Aliganj Aquatic Centre Aliganj Swimming โญ 4.6
5 Chinhat Tennis Club Chinhat Tennis, Badminton โญ 4.4
6 Jankipuram Fitness Hub Jankipuram Gym, Basketball โญ 4.3
7 Mahanagar Multi-Sports Mahanagar Badminton, TT, Volleyball โญ 4.5
8 Rajajipuram Cricket Academy Rajajipuram Cricket โญ 4.6
9 Eldeco Badminton Academy Eldeco Badminton โญ 4.9
10 Vikas Nagar Arena Vikas Nagar Football, Basketball โญ 4.2
11 Sahara Sports Village Sahara Cricket, Football, Squash, Tennis โญ 4.7
12 Kapoorthala Racket Club Kapoorthala Squash, TT, Badminton โญ 4.4
13 Aashiana Swimming & Wellness Aashiana Swimming, Gym โญ 4.5
14 Aminabad Basketball Court Aminabad Basketball โญ 4.1
15 Cantt Sports Ground Cantt Cricket, Football โญ 4.6

Venue Coverage Map

graph TD
subgraph LUCKNOW["๐Ÿ—บ๏ธ Lucknow โ€” 15 Venues Across 15 Areas"]
GN["Gomti Nagar<br/>๐Ÿธ๐Ÿ“๐Ÿ’ช"]
HG["Hazratganj<br/>๐Ÿ"]
IN["Indira Nagar<br/>โšฝ๐Ÿ"]
AL["Aliganj<br/>๐ŸŠ"]
CH["Chinhat<br/>๐ŸŽพ๐Ÿธ"]
JK["Jankipuram<br/>๐Ÿ‹๏ธ๐Ÿ€"]
MH["Mahanagar<br/>๐Ÿธ๐Ÿ“๐Ÿ"]
RJ["Rajajipuram<br/>๐Ÿ"]
EL["Eldeco<br/>๐Ÿธ"]
VN["Vikas Nagar<br/>โšฝ๐Ÿ€"]
SH["Sahara<br/>๐Ÿโšฝ๐Ÿ’ช๐ŸŽพ"]
KP["Kapoorthala<br/>๐Ÿ’ช๐Ÿ“๐Ÿธ"]
AA["Aashiana<br/>๐ŸŠ๐Ÿ‹๏ธ"]
AM["Aminabad<br/>๐Ÿ€"]
CT["Cantt<br/>๐Ÿโšฝ"]
end

style LUCKNOW fill:#0d2137,stroke:#06b6d4,color:#67e8f9
Loading

๐Ÿ“Š Dashboard Features

The Owner Dashboard provides comprehensive business intelligence through interactive visualizations:

graph LR
subgraph Dashboard["๐Ÿ“Š Dashboard Components"]
KPI["๐Ÿ“ˆ KPI Cards<br/>6 metrics with sparklines"]
BAR["๐Ÿ“Š SVG Bar Chart<br/>Monthly revenue trend"]
DONUT["๐Ÿฉ Donut Chart<br/>Sport distribution"]
TABLE["๐Ÿ“‹ Booking Table<br/>Recent activity feed"]
AI_INS["๐Ÿค– AI Insights<br/>Actionable recommendations"]
PRICING["๐Ÿ’ฐ Pricing Matrix<br/>Peak/off-peak/weekend"]
end

KPI --> BAR
KPI --> DONUT
BAR --> TABLE
DONUT --> AI_INS
AI_INS --> PRICING

style Dashboard fill:#1a1040,stroke:#8b5cf6,color:#c4b5fd
Loading
Component Description
KPI Stat Cards My Arenas, Total Revenue (with sparkline), Total Bookings, AI Booked %, Avg Rating, Today's Bookings
SVG Bar Chart Gradient bars with grid lines, value labels, month labels, booking counts โ€” zero external dependencies
Donut Chart Sport-wise booking distribution with colored segments, glow filters, legend with counts and percentages
Tab Navigation Overview / Revenue / Sports / AI Pricing โ€” organized content sections
AI Insights Weekend surge alerts, peak hour warnings, off-peak opportunities, AI adoption gap tracking
Revenue Breakdown Monthly table with per-booking averages, revenue share bars, MoM growth indicators
Booking Feed Recent bookings with user info, venue, sport badge, date/time, status, amount, and AI/Manual source badge

๐Ÿ”ฎ Future Scope

Feature Description
๐Ÿ“ฑ React Native App Cross-platform mobile app with push notifications
๐Ÿ’ณ Razorpay Payments Integrated payment gateway with auto-refunds
๐Ÿค– LLM Integration OpenAI/Gemini-powered natural language understanding
๐Ÿ‘ฅ AI Matchmaking Find nearby players for team sports
๐Ÿ† Tournament Engine Auto-generate brackets, fixtures, and leaderboards
๐Ÿ“Š Advanced Analytics Predictive demand modeling with ML pipelines
๐Ÿ’ฌ WhatsApp Bot Book venues via WhatsApp conversational interface
๐Ÿ”Š Voice Assistant Speech-to-text venue search and booking
๐ŸŒฆ๏ธ Weather Integration Auto-apply rainy day discounts using live weather APIs
๐Ÿ“ Multi-City Expansion Scale beyond Lucknow to Delhi, Bangalore, Mumbai

๐Ÿ‘จโ€๐Ÿ’ป Team โ€” Deepstack


Suryansh Singh
๐Ÿ† Team Leader ยท Full-Stack
Project vision, system design, AI agent pipeline, database architecture, and integration lead

Shivam Jaiswal
๐ŸŽจ Frontend Developer
React UI components, glassmorphism design system, Leaflet map integration, responsive layouts

Suyash Verma
โš™๏ธ Backend Developer
Express API routes, JWT auth middleware, Socket.IO real-time engine, booking conflict logic

Vikas Patel
๐Ÿค– AI/ML Engineer
NLP intent parser, recommendation agent, dynamic pricing engine, demand prediction algorithms

Team Workflow

graph LR
subgraph Team["๐Ÿ‘จโ€๐Ÿ’ป PlaySphere Team"]
SS["๐Ÿ† Suryansh Singh<br/>Team Lead ยท Architecture"]
SJ["โš™๏ธ Shivam Jaiswal<br/>Backend"]
SV["๐ŸŽจ Suyash Verma<br/>Frontend"]
VP["๐Ÿค– Vikas Patel<br/>AI/ML"]
end

SS -->|"System Design"| SJ
SS -->|"UI/UX Direction"| SV
SS -->|"AI Pipeline"| VP
SJ -->|"REST APIs"| SV
VP -->|"Agent Routes"| SJ

style SS fill:#0d2137,stroke:#06b6d4,color:#67e8f9
style SJ fill:#001a0e,stroke:#10b981,color:#6ee7b7
style SV fill:#1a1040,stroke:#8b5cf6,color:#c4b5fd
style VP fill:#1a0d00,stroke:#f59e0b,color:#fcd34d
Loading

๐ŸŒ Deployment Guide

Live Production Links

The production version of the app is live and fully accessible at:

Frontend โ€” Vercel / Netlify

The React frontend can be deployed to Vercel or Netlify with SPA routing support:

cd frontend
npm run build # Produces dist/ folder

Vercel: Connect your GitHub repo โ†’ Set root directory to frontend โ†’ Framework: Vite โ†’ Deploy.

Netlify: Connect your GitHub repo โ†’ Set build directory to frontend/dist โ†’ Build command: cd frontend && npm run build.

โš ๏ธ Set the environment variable VITE_API_URL to your Render backend URL (e.g. https://playsphere-y1sa.onrender.com).

Backend โ€” Render

Deploy the Express API server to Render:

  1. Create a new Web Service on Render
  2. Connect your GitHub repository
  3. Set Root Directory to backend
  4. Set Build Command to npm install
  5. Set Start Command to node server.js
  6. Add Environment Variables:
PORT=5000
JWT_SECRET=your_secure_secret_key
JWT_EXPIRE=30d
CLIENT_URL=https://your-frontend-url.vercel.app
FIREBASE_PROJECT_ID= # Optional
FIREBASE_CLIENT_EMAIL= # Optional
FIREBASE_PRIVATE_KEY= # Optional

Deployment Architecture

graph TB
subgraph Production["๐ŸŒ Production Deployment"]
subgraph FE_HOST["Frontend Host"]
VERCEL["โ–ฒ Vercel / Netlify<br/>React + Vite SPA"]
end

subgraph BE_HOST["Backend Host"]
RENDER["๐Ÿš€ Render<br/>Express + Socket.IO"]
end

subgraph DB_HOST["Database"]
FIRE["๐Ÿ”ฅ Firebase Firestore<br/>Cloud NoSQL"]
LOCAL["๐Ÿ“ localDb.json<br/>Dev Fallback"]
end
end

VERCEL -->|"HTTPS API Calls"| RENDER
VERCEL -->|"WebSocket"| RENDER
RENDER -->|"Firebase Admin SDK"| FIRE
RENDER -.->|"If no credentials"| LOCAL

style VERCEL fill:#0d2137,stroke:#06b6d4,color:#67e8f9
style RENDER fill:#001a0e,stroke:#10b981,color:#6ee7b7
style FIRE fill:#1a0d00,stroke:#f59e0b,color:#fcd34d
style LOCAL fill:#1a1040,stroke:#8b5cf6,color:#c4b5fd
Loading

๐Ÿ‘ฅ Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/ai-matchmaking)
  3. Commit changes (git commit -m 'Add AI matchmaking agent')
  4. Push to the branch (git push origin feature/ai-matchmaking)
  5. Open a Pull Request

๐Ÿ“„ License

Distributed under the MIT License. See LICENSE for details.


๐ŸŸ๏ธ PlaySphere โ€” Where AI Meets the Arena

Built with โค๏ธ by Team PlaySphere for the Agentic Premier League Hackathon 2026
Suryansh Singh ยท Shivam Jaiswal ยท Suyash Verma ยท Vikas Patel

React 18 ยท Node.js ยท Firebase ยท Socket.IO ยท Custom AI Agents ยท SVG Charts ยท Glassmorphism UI

โญ Star this repo if you find it useful! โญ

About

AI-powered sports infrastructure operating system for discovering, recommending and autonomously booking sports venues across Lucknow in real time

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors