A comprehensive Next.js quiz application built with TypeScript and TailwindCSS that provides interactive learning with detailed statistics and smart analytics.
π Live Demo on GitHub Pages
- π― Interactive Quizzes: Engage with carefully crafted questions that challenge your understanding
- π Detailed Analytics: Track your performance, identify strengths, and discover areas for improvement
- π‘ Smart Explanations: Learn from detailed explanations for each question to deepen your understanding
- β±οΈ Time Tracking: Monitor your response times and optimize your test-taking strategies
- π Statistics Dashboard: View comprehensive statistics including scores, timing, and performance trends
- π Google Sign-In: Sign in with your Google account to sync your data across multiple devices
- βοΈ Cloud Sync: Automatic synchronization of quizzes, sessions, and flashcards with Firebase
- ποΈ Flash Cards: Create and study flash cards to reinforce learning
- π Quiz to Flash Cards: Convert any quiz into flash cards automatically
- πΎ Local Storage: Your data is saved locally and syncs when signed in
Sign in with your Google account to:
- Sync quizzes across all your devices
- Access your quiz history anywhere
- Keep your flash cards synchronized
- Never lose your progress
- Create custom flash card decks
- Study with an interactive flip card interface
- Convert quizzes to flash cards automatically
- Organize cards by topic and difficulty
- Track your study progress
This application is automatically deployed to GitHub Pages on every push to the main branch. The deployment is handled by a GitHub Actions workflow that:
- Builds the Next.js application for static export
- Optimizes assets for production
- Deploys to GitHub Pages with proper routing
The app is configured for static export with the following optimizations:
- Static HTML generation for all routes
- Asset optimization and minification
- Proper base path configuration for GitHub Pages subdirectory hosting
- Image optimization disabled for static hosting compatibility
Every push to the main branch triggers an automated deployment via GitHub Actions:
# .github/workflows/deploy.yml
- Checkout code
- Setup Node.js environment
- Install dependencies
- Build for production
- Deploy to GitHub PagesTo use Firebase authentication and cloud sync on your deployed GitHub Pages site, you need to configure Firebase secrets in your GitHub repository:
-
Add Firebase Configuration to GitHub Secrets:
- Go to your repository on GitHub
- Navigate to
SettingsβSecrets and variablesβActions - Click
New repository secretand add the following secrets (get these values from your Firebase Console):FIREBASE_API_KEYFIREBASE_AUTH_DOMAINFIREBASE_PROJECT_IDFIREBASE_STORAGE_BUCKETFIREBASE_MESSAGING_SENDER_IDFIREBASE_APP_ID
-
How it Works:
- The GitHub Actions workflow automatically injects these secrets as environment variables during the build process
- The secrets are used to configure Firebase but are NOT committed to your repository
- Once built, the Firebase config will be in the compiled JavaScript (this is expected and secure)
- Security is enforced through Firebase Security Rules, not by hiding the API keys
-
Configure Firebase Security (Important!):
- In Firebase Console, set up Security Rules for Firestore
- Add your GitHub Pages domain to authorized domains in Firebase Authentication settings
- Enable App Check for additional security (recommended for production)
Note: Firebase client-side API keys are designed to be public. The real security comes from properly configured Firebase Security Rules and authorized domains, not from hiding the keys.
The application supports JSON quiz data in the following format:
[
{
"type": "singleSelect",
"question": "What is pipelining in a CPU?",
"options": [
"A technique to execute multiple instructions simultaneously by overlapping their execution phases",
"A method to increase CPU clock speed",
"A way to cool down the processor",
"A process for storing data in RAM"
],
"answer": [0],
"explanation": "Pipelining is a technique where multiple instruction execution phases are overlapped to improve CPU throughput. While one instruction is being decoded, another can be fetched, and yet another can be executed simultaneously."
}
]type: Currently supports"singleSelect"(more types can be added in the future)question: The question text to displayoptions: Array of answer options (strings)answer: Array of correct answer indices (0-based)explanation: Detailed explanation shown after answering
- Node.js 18+
- npm or yarn
- (Optional) Firebase account for authentication and cloud sync
- Clone the repository:
git clone https://github.com/UltimateBoi/QuizApp.git
cd QuizApp- Install dependencies:
npm install-
(Optional) Configure Firebase for authentication and cloud sync:
- Create a Firebase project at Firebase Console
- Enable Google Authentication in Firebase Console
- Create a Firestore database
- For local development: Copy
.env.local.exampleto.env.localand add your Firebase configuration:
cp .env.local.example .env.local
- Edit
.env.localwith your Firebase credentials - For GitHub Pages deployment: Add your Firebase credentials to GitHub Secrets (see "Configuring Firebase for GitHub Pages Deployment" section above)
-
Run the development server:
npm run dev- Open http://localhost:3000 in your browser
npm run buildThis generates a static export in the out/ directory suitable for GitHub Pages deployment.
src/
βββ app/ # Next.js app directory
β βββ globals.css # Global styles
β βββ layout.tsx # Root layout with AuthProvider
β βββ page.tsx # Home page with quiz and flashcard logic
βββ components/ # React components
β βββ QuestionCard.tsx
β βββ Quiz.tsx
β βββ ResultsScreen.tsx
β βββ Statistics.tsx
β βββ FlashCardView.tsx
β βββ FlashCardCreator.tsx
β βββ FlashCardManager.tsx
β βββ FlashCardStudy.tsx
β βββ QuizToFlashCards.tsx
β βββ AuthButton.tsx
βββ contexts/ # React contexts
β βββ AuthContext.tsx # Authentication context
βββ data/ # Quiz data
β βββ questions.ts
βββ hooks/ # Custom React hooks
β βββ useLocalStorage.ts
β βββ useFlashCards.ts
β βββ useFirebaseSync.ts
βββ lib/ # Third-party library configurations
β βββ firebase.ts # Firebase configuration
βββ types/ # TypeScript type definitions
β βββ quiz.ts
βββ utils/ # Utility functions
βββ quiz.ts
- Next.js 15: React framework with App Router and static export
- TypeScript: Type-safe JavaScript
- TailwindCSS: Utility-first CSS framework
- React Hooks: State management and side effects
- Firebase: Authentication and real-time database
- Google Authentication: Secure sign-in with Google
- Local Storage: Client-side data persistence with cloud sync
- GitHub Pages: Static site hosting with automated deployment
- Home Screen: Welcome page with feature overview and progress summary
- Quiz Interface: Interactive questions with multiple choice options
- Real-time Feedback: Immediate answer validation with explanations
- Results Screen: Comprehensive score breakdown with detailed analytics
- Statistics Dashboard: Historical performance tracking and trends
- Total quizzes completed
- Average and best scores
- Time spent per question and total time
- Question-by-question performance breakdown
- Recent session history
- Performance level indicators
The application is fully responsive and works on:
- Desktop computers
- Tablets
- Mobile phones
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
Changes to the main branch will automatically deploy to GitHub Pages!
This project is licensed under the ISC License.