Real-time soccer match tracking platform with AI-powered analysis. Track live matches from major leagues, follow your favorite teams, and get intelligent match insights powered by GPT-4o-mini.
- Live Match Tracking: Real-time score updates from major leagues worldwide
- AI-Powered Analysis: Pre-match predictions, live commentary, halftime analysis, and post-match insights
- Team Following: Follow your favorite teams and get personalized notifications
- Real-time Updates: WebSocket connections for instant score and event updates
- Beautiful UI: Modern, responsive design with dark mode
- Smart Caching: Redis-powered caching for optimal performance
- Node.js 20+ with TypeScript
- Express.js
- Prisma (PostgreSQL ORM)
- Redis (caching)
- Socket.io (real-time)
- JWT authentication
- OpenAI GPT-4o-mini
- API-FOOTBALL (RapidAPI)
- React 18 with TypeScript
- Vite
- Tailwind CSS
- Zustand (state management)
- React Router v6
- Socket.io-client
- Axios
- Node.js 20 or higher
- PostgreSQL 15 or higher
- Redis 7 or higher
- API-FOOTBALL API key (from RapidAPI)
- OpenAI API key
# Install backend dependencies
cd backend
npm install
# Install frontend dependencies
cd ../frontend
npm install# Create database
createdb livefootball
# Or using psql
psql -U postgres
CREATE DATABASE livefootball;# macOS (using Homebrew)
brew install redis
brew services start redis
# Linux (Ubuntu/Debian)
sudo apt-get install redis-server
sudo systemctl start redis
# Or run with Docker
docker run -d -p 6379:6379 redis:7-alpineBackend (backend/.env):
cp backend/.env.example backend/.envEdit backend/.env:
DATABASE_URL="postgresql://user:password@localhost:5432/livefootball"
REDIS_URL="redis://localhost:6379"
JWT_SECRET="your-super-secret-jwt-key"
JWT_REFRESH_SECRET="your-super-secret-refresh-key"
JWT_EXPIRY="15m"
JWT_REFRESH_EXPIRY="7d"
OPENAI_API_KEY="sk-your-openai-api-key"
RAPIDAPI_KEY="your-rapidapi-key"
RAPIDAPI_HOST="api-football-v1.p.rapidapi.com"
FRONTEND_URL="http://localhost:5173"
NODE_ENV="development"
PORT=3001Frontend (frontend/.env):
cp frontend/.env.example frontend/.envEdit frontend/.env:
VITE_API_URL=http://localhost:3001/api
VITE_WS_URL=ws://localhost:3001cd backend
# Generate Prisma client
npm run prisma:generate
# Run database migrations
npm run prisma:migrate
# (Optional) Seed database
npm run prisma:seedTerminal 1 - Backend:
cd backend
npm run devThe backend will start on http://localhost:3001
Terminal 2 - Frontend:
cd frontend
npm run devThe frontend will start on http://localhost:5173
- Go to RapidAPI
- Sign up for an account
- Subscribe to API-FOOTBALL
- Copy your API key from the dashboard
- Free tier includes 100 requests/day
- Go to OpenAI Platform
- Sign up or log in
- Navigate to API keys section
- Create a new API key
- Copy and save it securely
futbolito/
├── backend/
│ ├── src/
│ │ ├── config/ # Database, Redis configs
│ │ ├── controllers/ # Route controllers
│ │ ├── middleware/ # Auth, error handling
│ │ ├── routes/ # API routes
│ │ ├── services/ # Business logic
│ │ ├── websocket/ # Socket.io server
│ │ ├── utils/ # Utilities
│ │ ├── types/ # TypeScript types
│ │ ├── prisma/ # Prisma schema, seeds
│ │ └── index.ts # Entry point
│ └── package.json
│
├── frontend/
│ ├── src/
│ │ ├── components/ # React components
│ │ ├── pages/ # Page components
│ │ ├── store/ # Zustand stores
│ │ ├── services/ # API services
│ │ ├── hooks/ # Custom hooks
│ │ ├── utils/ # Utilities
│ │ ├── types/ # TypeScript types
│ │ └── main.tsx # Entry point
│ └── package.json
│
├── specs.json # Project specifications
└── README.md # This file
POST /api/auth/register- Register new userPOST /api/auth/login- Login userPOST /api/auth/refresh- Refresh access tokenGET /api/auth/me- Get current user (protected)
GET /api/matches/live- Get live matchesGET /api/matches/:id- Get match detailsGET /api/matches/:id/insights- Get match AI insightsPOST /api/matches/:id/insights- Generate AI insight (protected)
GET /api/teams/search?q=query- Search teamsPOST /api/teams/:id/follow- Follow team (protected)DELETE /api/teams/:id/follow- Unfollow team (protected)
GET /api/users/me/following- Get followed teams (protected)
subscribe_match- Subscribe to match updatesunsubscribe_match- Unsubscribe from matchsubscribe_team- Subscribe to team updates
match_update- Real-time score updatematch_event- Goal, card, substitution eventmatch_started- Match has startedmatch_ended- Match finishedai_insight- New AI insight generated
# Backend tests
cd backend
npm test
# Frontend tests
cd frontend
npm test# Open Prisma Studio (database GUI)
npm run prisma:studio
# Create new migration
npm run prisma:migrate
# Reset database
npx prisma migrate reset- Create account on Railway
- Create new project
- Add PostgreSQL and Redis services
- Deploy backend from GitHub
- Set environment variables
- Deploy!
- Create account on Vercel
- Import GitHub repository
- Set root directory to
frontend - Add environment variables
- Deploy!
# Check PostgreSQL is running
psql -U postgres -c "SELECT 1"
# Check connection string format
DATABASE_URL="postgresql://USER:PASSWORD@HOST:PORT/DATABASE"# Test Redis connection
redis-cli ping
# Should return: PONG
# Check Redis is running
redis-cli
> INFO serverAPI-FOOTBALL free tier has 100 requests/day. The app implements aggressive caching to minimize API calls:
- Live matches: Cached for 30 seconds
- Match details: Cached for 1 minute (live) or 1 hour (finished)
- Team data: Cached for 24 hours
This is a learning project. Feel free to fork and experiment!
MIT
For issues or questions, please create an issue in the GitHub repository.
Built with ⚽ by Claude Code