Skip to content

About

πŸš€ KeySmasher: A full-stack, real-time multiplayer typing race app built with React, Node.js, and Socket.IO. Compete, track your stats, and experience lightning-fast typing battles in a modern web environment.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

Β 

History

58 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

KeySmasher

KeySmasher is a modern, full-stack, multiplayer typing speed test and racing application. It allows users to practice typing, compete in real-time typing races, track their progress, and view leaderboards. Built with a React + Vite frontend and an Express + MongoDB backend, KeySmasher offers a sleek, responsive UI and robust real-time features powered by Socket.IO.


Table of Contents


Features

  • Typing Practice: Solo typing tests with WPM, accuracy, and score calculation.
  • Multiplayer Races: Join or create rooms to race against friends or random users in real-time.
  • Leaderboard: Track top performers and your own stats.
  • User Profiles: View and edit your profile, track your typing history and stats.
  • Customizable Settings: Adjust test duration, dark mode, and more.
  • Responsive UI: Works seamlessly on desktop and mobile devices.
  • Real-time Updates: Powered by Socket.IO for instant race updates.

Tech Stack

Frontend:

  • React 19
  • TailwindCSS for styling
  • React Router for navigation
  • React Icons for UI elements

Backend:

  • Node.js + Express
  • MongoDB (via Mongoose)
  • Socket.IO for real-time communication
  • JWT for authentication
  • BcryptJS for password hashing

Getting Started

Prerequisites

  • Node.js (v18+ recommended)
  • npm or yarn
  • MongoDB (local or cloud instance)

Installation

  1. Clone the repository:

    git clone https://github.com/yourusername/KeySmasher.git
    cd KeySmasher
  2. Install dependencies for both frontend and backend:

    cd frontend
    npm install
    cd ../backend
    npm install
  3. Set up environment variables:

    • Copy .env.example to .env in the backend/ directory and fill in your MongoDB URI and JWT secret.

Running the App

Start the backend:

cd backend
npm start

Start the frontend:

cd frontend
npm run dev

Project Structure

KeySmasher/
β”‚
β”œβ”€β”€ frontend/         # React + Vite frontend
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ components/   # UI components (TypingBox, TypingArea, LeaderBoard, etc.)
β”‚   β”‚   β”œβ”€β”€ pages/        # Main pages (Profile, Settings, RoomPage, etc.)
β”‚   β”‚   β”œβ”€β”€ context/      # React context for global state
β”‚   β”‚   β”œβ”€β”€ utils/        # Utility functions (text generation, result calculation)
β”‚   β”‚   └── App.jsx       # Main app entry
β”‚   └── ...               # Config files, public assets, etc.
β”‚
β”œβ”€β”€ backend/          # Express + MongoDB backend
β”‚   β”œβ”€β”€ controllers/  # Route controllers (user, room, result)
β”‚   β”œβ”€β”€ models/       # Mongoose models (User, Room, Result)
β”‚   β”œβ”€β”€ routes/       # API route definitions
β”‚   β”œβ”€β”€ sockets/      # Socket.IO logic
β”‚   β”œβ”€β”€ middlewares/  # Express middlewares (auth, error handling)
β”‚   β”œβ”€β”€ config/       # DB and environment config
β”‚   └── server.js     # Main server entry point
β”‚
└── README.md         # Project documentation

Usage

  • Solo Typing Test: Visit the home page and start typing to test your speed and accuracy.
  • Multiplayer Race: Create or join a room to compete with others in real-time. The race starts with a countdown and results are shown at the end.
  • Profile & Stats: View your typing history, stats, and edit your profile.
  • Leaderboard: See how you rank against other users.

API Overview

The backend exposes RESTful endpoints under /api/:

  • POST /api/user/register - Register a new user
  • POST /api/user/login - Login and receive JWT
  • GET /api/user/profile - Get user profile (auth required)
  • POST /api/room/create - Create a new race room
  • POST /api/room/join - Join an existing room
  • GET /api/room/:id - Get room details
  • POST /api/result - Submit typing result
  • GET /api/result/user/:id - Get user results

See the backend routes/ and controllers/ for more details.


Contributing

Contributions are welcome! To contribute:

  1. Fork the repository
  2. Create a new branch (git checkout -b feature/your-feature)
  3. Commit your changes
  4. Push to your fork and submit a pull request

Please open issues for suggestions or bug reports.


Acknowledgements

  • Inspired by popular typing test platforms like Monkeytype and TypeRacer.

About

πŸš€ KeySmasher: A full-stack, real-time multiplayer typing race app built with React, Node.js, and Socket.IO. Compete, track your stats, and experience lightning-fast typing battles in a modern web environment.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages