The ultimate typing speed test for developers. Race against time (and others) by typing real code snippets.
Improve your syntax muscle memory, track your WPM, and climb the leaderboards.
π View the Hall of Fame | π Report a Bug |
- Real Code Challenges - Type actual code snippets from popular problems
- Real-Time Multiplayer - Race against friends in live lobbies with WebSockets
- Performance Tracking - Track your WPM, accuracy, and personal records
- Leaderboards - Compete globally on the leaderboards
- User Profiles - View your stats and search your performance history
- GitHub Authentication - Sign in seamlessly with Firebase Auth
- Next.js
- Tailwind CSS
- SWR
- WebSockets
- FastAPI
- Redis (Upstash)
- Firebase Admin
- WebSockets
- Google Cloud Run
- Vercel
- Docker
- Python 3.11+
- Node.js 18+
- Firebase project with GitHub auth enabled
- Upstash Redis database
git clone https://github.com/imrahnf/speedtcode.git
cd speedtcodecd backend
# Create virtual environment
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\Activate
# Install dependencies
pip install -r requirements.txt
# Configure environment (see Environment Setup below)
# Then run
uvicorn main:app --reloadBackend runs at http://localhost:8000
cd frontend
npm install
npm run devFrontend runs at http://localhost:3000
Root .env (Backend)
Get your Redis connection string from the Upstash Console.
REDIS_URL=rediss://default:PASSWORD@HOST:6379Root firebase-credentials.json (Backend)
Required for the backend to verify tokens.
- Go to Firebase Console β Project Settings β Service accounts.
- Click Generate new private key.
- Rename the file to
firebase-credentials.jsonand place it in the root.
frontend/.env.local (Frontend)
Get these from Firebase Console β Project Settings β General β Your apps (Web).
NEXT_PUBLIC_FIREBASE_API_KEY=AIza...
NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN=project.firebaseapp.com
NEXT_PUBLIC_FIREBASE_PROJECT_ID=project-id
NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET=project.firebasestorage.app
NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID=123456789
NEXT_PUBLIC_FIREBASE_APP_ID=1:123456789:web:abc...
NEXT_PUBLIC_API_URL=http://localhost:8000| Endpoint | Method | Description |
|---|---|---|
GET /healthz |
Health check | Server status |
GET /api/problems |
Get all problems | List of coding challenges |
GET /api/problems/{id} |
Get problem details | Problem metadata + code |
GET /api/problems/{id}/content/{lang} |
Get problem content | Specific language content |
POST /api/lobbies |
Create lobby | Multiplayer room creation |
GET /api/lobbies/{id} |
Get lobby info | Lobby details and players |
WS /ws/lobby/{id}/{userId}/{username} |
WebSocket | Real-time lobby connection |
POST /api/results |
Submit result | Save typing performance |
GET /api/leaderboard/{id} |
Get leaderboard | Top scores for problem |
GET /api/users/{username} |
Get user stats | User profile and stats |
GET /api/users/{username}/problems/{id} |
Get user problem stats | Performance on specific problem |
GET /api/users/me/stats |
Get my stats | Current user stats |
speedtcode/
βββ backend/
β βββ main.py # FastAPI app & startup
β βββ routers/
β β βββ general.py # Health check
β β βββ problems.py # Problem endpoints
β β βββ lobbies.py # Multiplayer lobbies
β β βββ results.py # Performance tracking
β β βββ users.py # User profiles
β βββ services/
β β βββ redis_service.py # Redis client wrapper
β β βββ lobby_manager.py # Lobby state management
β βββ models/
β β βββ problem_manager.py # Problem loading
β βββ problems/ # Actual challenge files
β β βββ python/
β β βββ javascript/
β β βββ cpp/
β βββ Dockerfile # Container config
β βββ requirements.txt
β
βββ frontend/
β βββ src/
β β βββ app/
β β β βββ page.js # Landing page
β β β βββ play/ # Singleplayer mode
β β β βββ lobby/ # Multiplayer mode
β β β βββ profile/ # User profile
β β βββ components/
β β β βββ typing/
β β β β βββ TypingEngine.tsx # Core typing logic
β β β βββ lobby/
β β β βββ LobbySidebar.tsx
β β β βββ HostControls.tsx
β β βββ context/
β β β βββ AuthContext.tsx # Firebase auth state
β β βββ lib/
β β βββ firebase.ts # Firebase config
β βββ package.json
β
βββ cloudbuild.yaml # Cloud Build config
βββ README.md
Test the containerized backend locally before deploying:
# Build image
docker build -f backend/Dockerfile -t speedtcode-backend:latest .
# Run container
docker run --rm -p 8000:8000 \
--env-file .env \
-v "${PWD}/firebase-credentials.json:/app/firebase-credentials.json:ro" \
speedtcode-backend:latestVerify: curl http://localhost:8000/docs
1. Setup
gcloud auth login
gcloud config set project YOUR_PROJECT_ID
gcloud services enable run.googleapis.com cloudbuild.googleapis.com2. Create cloud-run-env.yaml
Use the same values as your local setup. For FIREBASE_CREDENTIALS_JSON, paste the key file into one line.
REDIS_URL: "rediss://default:PASSWORD@HOST:6379"
FIREBASE_CREDENTIALS_JSON: '{"type":"service_account",...}'3. Build & Deploy
# Build in cloud
gcloud builds submit --config cloudbuild.yaml .
# Deploy
gcloud run deploy speedtcode-backend \
--image gcr.io/YOUR_PROJECT_ID/speedtcode-backend \
--platform managed \
--region us-central1 \
--allow-unauthenticated \
--env-vars-file cloud-run-env.yaml \
--timeout 3600 \
--min-instances 0 \
--max-instances 1Have you tested the app? I'm looking for technical feedback on the stability and typing engine latency. β£ Submit your Feedback & Bug Reports here
By submitting the form, you can opt-in to be featured in the Hall of Fame below!
A massive thank you to everyone who helped stress test the game and try to break the typing engine!
![]() imrahnf Me! |
![]() imankamrann Tester |
![]() burhanf Tester |
![]() HARSHEE04 Tester |
![]() MaryamElhamidi Tester |
Built with β€οΈ by Omrahn Faqiri




