Before running this project, you need to have Node.js installed on your system.
- Visit https://nodejs.org/
- Download the LTS version (v18 or v20)
- Run the installer and follow the instructions
- Verify installation:
node --version npm --version
brew install node# Install nvm
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
# Install Node.js
nvm install --lts
nvm use --ltsRun the setup script:
./setup.shIf you prefer to set up manually:
-
Install dependencies:
npm install
-
Start development server:
npm run dev
-
Open your browser: Navigate to http://localhost:3000
npm run dev # Start development server on port 3000
npm run build # Build for production
npm start # Run production server
npm run seed # Seed demo data (requires dev server running)✅ All features are implemented and working:
- ✅ Multiple choice questions - 4 options per question
- ✅ Immediate feedback - See correct answers and explanations instantly
- ✅ Review screen - Review all your answers after completing the quiz
- ✅ Score tracking - File-based demo storage for attempts
- ✅ 24 curated questions - Stored in
data/questions.json
- ✅ Timed mode - Optional timer with time bonus scoring
- ✅ Badges & Profile - Profile page with badge placeholders
- ✅ Admin page - Add new questions via web interface
- ✅ Leaderboard - Demo leaderboard with top players
- ✅ Responsive design - Beautiful Arabian Nights theme with Tailwind CSS
- Click "Play Now" on the homepage
- Toggle "Timed mode" on/off as desired
- Answer 10 random questions
- Review your score and answers
- Navigate to
/adminpage - Fill in the question form:
- Question text
- 4 options
- Correct answer index (0-3)
- Difficulty level
- Click "Add Question"
- Navigate to
/leaderboard - See top players and scores
- Navigate to
/profile - View your badges and total score (demo data)
arabian-nights-quiz/
├── components/ # React components
│ ├── Header.js # Navigation header
│ ├── QuestionCard.js # Quiz question display
│ ├── LeaderboardList.js
│ └── Timer.js # Timer component
├── data/ # JSON data storage
│ ├── questions.json # Question database
│ ├── attempts.json # User attempts
│ └── leaderboard.json # Leaderboard data
├── pages/ # Next.js pages
│ ├── index.js # Homepage
│ ├── quiz.js # Quiz page
│ ├── review.js # Review answers
│ ├── leaderboard.js # Leaderboard
│ ├── profile.js # User profile
│ ├── admin.js # Admin panel
│ └── api/ # API routes
│ ├── questions.js # Fetch questions
│ ├── attempts.js # Save attempts
│ ├── leaderboard.js
│ └── seed.js # Seed new questions
├── styles/ # CSS styles
│ └── globals.css # Global styles + Tailwind
└── lib/ # Utilities
└── supabaseClient.js # Supabase config (optional)
If port 3000 is busy, the dev server will automatically try the next available port (3001, 3002, etc.)
If you see Unknown at rule @tailwind warnings in your editor:
- These are harmless - the build will work fine
- Install the Tailwind CSS IntelliSense VS Code extension to remove them
If you encounter build errors:
# Clear cache and reinstall
rm -rf node_modules package-lock.json .next
npm install
npm run devThis project includes optional Supabase integration for authentication and cloud storage.
- Create a project at https://supabase.com
- Copy
.env.local.exampleto.env.local - Add your Supabase credentials:
NEXT_PUBLIC_SUPABASE_URL=your-project-url NEXT_PUBLIC_SUPABASE_ANON_KEY=your-anon-key
- Modify API endpoints in
pages/api/to use Supabase instead of file storage
- Push this repo to GitHub
- Visit https://vercel.com
- Import your GitHub repository
- Vercel will automatically detect Next.js and deploy
- Add environment variables in Vercel dashboard if using Supabase
If you encounter any issues:
- Check that Node.js is installed:
node --version - Ensure dependencies are installed:
npm install - Clear Next.js cache:
rm -rf .next - Check the terminal for error messages
This is a hackathon scaffold project. Feel free to use and modify!
Enjoy exploring the Arabian Nights! 🌙✨