A beautiful typing game with real-time leaderboards powered by Firebase Firestore.
- Three Game Modes: Normal, Endless, and Accuracy Challenge
- Real-time Leaderboards: Powered by Firebase Firestore
- User Profiles: XP, levels, and game history
- Beautiful UI: Pixel art effects and dark/light theme
- Responsive Design: Works on desktop and mobile
- Go to Firebase Console
- Click "Create a project" or "Add project"
- Enter a project name (e.g., "bisctype-typing-game")
- Follow the setup wizard (you can disable Google Analytics if not needed)
- In your Firebase project, go to "Firestore Database"
- Click "Create database"
- Choose "Start in test mode" (for development)
- Select a location close to your users
- Click "Done"
- In your Firebase project, click the gear icon ⚙️ next to "Project Overview"
- Select "Project settings"
- Scroll down to "Your apps" section
- Click the web icon (</>)
- Register your app with a nickname (e.g., "BiscType Web")
- Copy the firebaseConfig object
- Open
firebase-config.js - Replace the placeholder values with your actual Firebase configuration:
const firebaseConfig = {
apiKey: "your-actual-api-key",
authDomain: "your-project-id.firebaseapp.com",
projectId: "your-project-id",
storageBucket: "your-project-id.appspot.com",
messagingSenderId: "your-messaging-sender-id",
appId: "your-app-id"
};In your Firebase Console, go to Firestore Database > Rules and update the rules:
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
// Allow read/write access to leaderboards
match /leaderboards/{leaderboardType}/entries/{entryId} {
allow read, write: if true;
}
// Allow read/write access to user profiles
match /userProfiles/{username} {
allow read, write: if true;
}
}
}Note: These rules allow public read/write access. For production, implement proper authentication and security rules.
- Open
index.htmlin a web browser - Enter a username to start playing
- Choose a game mode and begin typing!
Typing Game/
├── index.html # Main HTML file
├── script.js # Game logic
├── styles.css # Styling
├── firebase-config.js # Firebase configuration
├── firebase-service.js # Firebase service functions
└── README.md # This file
The app creates the following Firestore collections:
leaderboards/{type}/entries- Leaderboard entries for level, wpm, and endless modesuserProfiles/{username}- User profiles with stats and game history
- Leaderboards update in real-time when other users play
- No need to refresh the page to see new scores
- If Firebase is unavailable, the app falls back to localStorage
- Ensures the game works even without internet connection
- User profiles and leaderboards are stored in Firebase
- Theme preferences are stored locally
-
"Firebase is not defined" error
- Make sure you've included the Firebase SDK scripts in
index.html - Check that
firebase-config.jsis loaded beforefirebase-service.js
- Make sure you've included the Firebase SDK scripts in
-
Leaderboard not updating
- Check your Firebase configuration in
firebase-config.js - Verify Firestore security rules allow read/write access
- Check browser console for error messages
- Check your Firebase configuration in
-
CORS errors
- Make sure you're running the app from a web server (not just opening the HTML file)
- Use a local server like
python -m http.serveror Live Server extension
To run a local development server:
# Using Python 3
python -m http.server 8000
# Using Node.js (if you have http-server installed)
npx http-server
# Using PHP
php -S localhost:8000Then open http://localhost:8000 in your browser.
For production deployment:
- Implement Firebase Authentication
- Set up proper Firestore security rules
- Enable Firebase App Check
- Use environment variables for Firebase config
- Implement rate limiting for leaderboard updates
This project is open source and available under the MIT License.