Byte Size Trivia is an interactive quiz game featuring two different game modes.
In Custom Mode, players can personalize their experience by selecting the quiz category, difficulty level, and the number of questions - perfect for practicing trivia.
Alternatively, Challenge Mode offers an unlimited series of questions where players must answer each question within the 15 second time limit. Answer incorrectly or run out of time, then they lose a life. Once all lives are lost, the game ends. Players can track their highscore and compete against each other for the top spot on the leaderboard.
Byte Size Trivia is built using the following technologies:
- TypeScript - Learn More
- React - Learn More
- Tailwind CSS - Learn More
- React Router - Learn More
- React Toastify - Learn More
- Vite - Learn More
- Firebase:
- Hosting - Learn More
- User Authentication - Learn More
- Firestore Database - Learn More
To get started with Byte Size Trivia, follow the steps below to clone the repository, install dependencies, and set up Firebase for user authentication, Firestore, and optional hosting.
Begin by cloning the repository from GitHub:
git clone https://github.com/sam-champion/quiz-app.git
cd byte-size-trivia
Install the required dependencies using npm:
npm install
This will install the necessary packages specified in the package.json file, including Firebase, React, React Router, Tailwind CSS, and TypeScript.
To enable user authentication and Firestore in your app, you need to create a Firebase project and configure the Firebase SDK.
- Go to https://firebase.google.com/ and navigate to the Firebase Console.
- Click on "Create a project" and follow the steps to create a new Firebase project.
- In your Firebase project, navigate to Authentication in the left sidebar.
- Click on the Get Started button.
- Enable the authentication method for Email/Password.
- In the Firebase Console, navigate to Firestore Database in the left sidebar.
- Click on Create Database and choose Start in test mode to enable Firestore.
- Follow the prompts to set up your Firestore database.
If you want to deploy the app using Firebase Hosting:
Install the Firebase CLI globally (if you haven’t already):
npm install -g firebase-tools
Log in to Firebase using the Firebase CLI:
firebase login
Initialize Firebase in your project:
firebase init
- Go to the Firebase Console and navigate to Project Settings.
- Under Your Apps, select Web and register the app to get your Firebase configuration.
- Copy the Firebase config object and replace the values in the src/firebase.ts file with your config:
import { initializeApp } from "firebase/app";
import { getAnalytics } from "firebase/analytics";
import { getAuth } from "firebase/auth";
import { getFirestore } from "firebase/firestore";
const firebaseConfig = {
apiKey: "your-api-key",
authDomain: "your-auth-domain",
projectId: "your-project-id",
storageBucket: "your-storage-bucket",
messagingSenderId: "your-sender-id",
appId: "your-app-id",
};
const firebaseApp = initializeApp(firebaseConfig);
export const auth = getAuth(firebaseApp);
export const db = getFirestore(firebaseApp);
export const analytics = getAnalytics(firebaseApp);
export default firebaseApp;
After completing the Firebase setup, you can run the app locally to test it:
npm run dev
The app should now be running locally, and you can start interacting with the quiz game.
To build and deploy the app to Firebase Hosting, use the following commands:
Build the app:
npm run build
Deploy the app:
firebase deploy
After deployment, Firebase will provide a hosting URL where you can access the live app.
This project is licensed under the MIT License. See here for more information.