A real-time score tracking system designed for offline course group competitions, featuring admin controls and persistent data storage.
-
Real-time Score Management
- Track scores for multiple groups simultaneously
- Visual score comparison with animated charts
- Automatic highest score highlighting
-
Admin System
- Secure admin access via URL parameter
- Persistent admin authentication
- Protected score modification controls
-
Data Persistence
- Permanent data storage with Upstash Redis
- Data remains until explicit admin reset
- Secure data management
-
User Interface
- Clean, responsive design
- Animated transitions and interactions
- Mobile-friendly layout
- Framework: Next.js 14 (App Router)
- Database: Upstash Redis
- UI Components: Shadcn UI
- Styling: Tailwind CSS
- State Management: Zustand
- Charts: Recharts
- Animations: Framer Motion
- Package Manager: Bun
- Clone the repository:
git clone https://github.com/yourusername/offline-course-score-tracker.git
cd offline-course-score-tracker- Install dependencies:
bun install- Create a
.env.localfile and set the following environment variables:
cp .env.example .env.local- Start the development server:
bun dev- Visit
http://localhost:3000?user=admin - Admin status persists across sessions
- Admin features include:
- Creating and editing groups
- Modifying scores
- Resetting all data (with confirmation)
- Create groups with names and descriptions
- Add scores using predefined increments
- View real-time score comparisons
- Track highest scoring group
- Only available to admin users
- Requires typing "确认删除" for confirmation
- Completely resets scores and admin permissions
src/
├── app/ # Next.js app router
│ ├── api/ # API routes
│ └── page.tsx # Main page
├── components/ # React components
│ ├── score-tracker/ # Score tracking components
│ └── ui/ # UI components
├── hooks/ # Custom React hooks
├── lib/ # Utility functions
└── store/ # Zustand storeGET /api/scores- Retrieve all group scoresPOST /api/scores- Update group scoresGET /api/admin/check- Verify admin statusPOST /api/admin/check- Register admin accessPOST /api/killall- Reset all data (admin only)
KV_URL- Upstash Redis URLKV_REST_API_URL- Upstash REST API URLKV_REST_API_TOKEN- Upstash REST API tokenKV_REST_API_READ_ONLY_TOKEN- Upstash REST API read-only token