Real-time sports apps are among the most satisfying things to build — and cricket, with its ball-by-ball drama, is particularly well-suited to live data. In this tutorial we will build a live scoreboard with Next.js 14 App Router and the Cricwix API.
What We Are Building
A Next.js app that shows all live cricket matches, auto-refreshes scores every 10 seconds, and links through to a full scorecard page for each match. We will use React Server Components for the initial render and client-side polling for updates.
Prerequisites
- Node.js 18+
- A Cricwix API key (free at cricwix.com)
- Basic familiarity with Next.js App Router
Project Setup
Add your API key to .env.local:
Fetching Live Fixtures
Create a data fetching function in lib/cricket.ts:
Building the Scoreboard Component
Adding Auto-Refresh
Next.js ISR with revalidate: 10 handles server-side freshness. For a true real-time feel on the client, add a lightweight polling wrapper:
Deploying to Vercel
Push to GitHub, connect to Vercel, add CRICWIX_API_KEY as an environment variable, and deploy. Vercel's Edge Network pairs perfectly with Cricwix's low-latency API for global users.
Pro tip: Upgrade to the Cricwix Pro plan for 100,000 requests per day — more than enough for a production app with thousands of users.
Next Steps
- Add a /match/[id] page using the /scores endpoint for full scorecards
- Integrate /players to show player career stats on click
- Add push notifications when a wicket falls using the ball-by-ball stream
// ready to build?
Start free today
100 free API calls per day. No credit card required.
Get your API key →