A modern, interactive gaming platform built with Next.js, featuring multiple games, user authentication, and comprehensive admin management. Accessible at: https://game-space-one.vercel.app/
GameSpace is a comprehensive web-based gaming platform that brings together classic and modern games in a beautifully designed interface. Built with Next.js and MongoDB, it offers a seamless gaming experience with user authentication, score tracking, social features, and administrative controls.
- Snake: Classic snake game with progressive difficulty and wrap-around boundaries
- Whack-a-Mole: Fast-paced arcade game testing reflexes and reaction time
- Memory Match: Brain-training card matching game with emoji pairs
- Tic Tac Toe: Strategic two-player game with intelligent gameplay
- 1024: Number puzzle game similar to 2048, challenging strategic thinking
- Secure user registration and login system
- JWT-based session management with HttpOnly cookies
- Password encryption using bcrypt
- Admin role management and privileges
- Comprehensive user dashboard with game statistics
- Score tracking across all games
- Game activity history and analytics
- Achievement system UI (currently uses static mock data for demonstration)
Note: The profile page uses real-time data from the database for user info and game scores. Achievement system currently displays static demo data.
- Real-time score tracking and leaderboards
- Responsive design for desktop and mobile
- Interactive commenting system for each game
- Smooth animations and modern UI/UX
- Complete user management system
- Real-time platform statistics
- User role management (admin/regular user)
- Content moderation tools
- Next.js 15.3.1 - React framework for production
- React 19.1.0 - User interface library
- Tailwind CSS 4 - Utility-first CSS framework
- PostCSS - CSS processing tool
- Next.js API Routes - Serverless API endpoints
- MongoDB 6.16.0 - NoSQL database
- JWT (jsonwebtoken 9.0.2) - Authentication tokens
- bcrypt 5.1.1 - Password hashing
- ESLint - Code linting
- JavaScript - Primary programming language
- Node.js 16+ installed
- MongoDB Atlas account or local MongoDB instance
- Git for version control
git clone https://github.com/abdularhamkhan/GameSpace.git
cd GameSpacenpm installCreate a next.config.mjs file with your database credentials:
const nextConfig = {
reactStrictMode: true,
serverRuntimeConfig: {
DATABASE_URL: "your_mongodb_connection_string",
JWT_SECRET: "your_jwt_secret_key",
JWT_EXPIRES_IN: "1h"
},
publicRuntimeConfig: {
staticFolder: '/static',
},
};
export default nextConfig;The application will automatically create the necessary collections:
- Users - User accounts and authentication
- Comments - Game comments and discussions
- Scores - Game scores and statistics
Run the admin setup script to create your first admin user:
node scripts/set-first-admin.jsnpm run devThe application will be available at http://localhost:3000.
- Objective: Guide the snake to eat food while avoiding collisions
- Features: Progressive speed increase, boundary wrap-around, high score tracking
- Controls: Arrow keys for movement, spacebar to pause
- Objective: Hit as many moles as possible within the time limit
- Features: 25-second gameplay, random mole spawning, animated transitions
- Controls: Click/tap on moles to score points
- Objective: Find all matching pairs of emoji cards
- Features: 6 pairs (12 cards), move counter, time tracking
- Controls: Click cards to flip and find matches
- Objective: Get three in a row before your opponent
- Features: Two-player gameplay, win detection, draw logic
- Controls: Click on grid squares to place marks
- Objective: Combine numbered tiles to reach 1024
- Features: 4x4 grid, tile combination mechanics, score calculation
- Controls: Arrow keys or swipe gestures to move tiles
POST /api/auth/signup- User registrationPOST /api/auth/login- User loginPOST /api/auth/logout- User logoutGET /api/auth/me- Get current user infoGET /api/auth/check-admin- Check admin privileges
GET /api/[game]/comments- Get game commentsPOST /api/[game]/comments- Add game commentGET /api/[game]/scores- Get game scoresPOST /api/[game]/scores- Submit game score
GET /api/admin/users- Get all usersGET /api/admin/stats- Get platform statisticsPOST /api/admin/set-admin-status- Manage user roles
DELETE /api/deleteComment/[commentID]- Delete specific comment
GameSpace/
โโโ components/ # Reusable React components
โ โโโ auth/ # Authentication forms
โ โโโ games/ # Individual game components
โ โ โโโ snake/ # Snake game implementation
โ โ โโโ whack-a-mole/# Whack-a-Mole game
โ โ โโโ memory-match/# Memory Match game
โ โ โโโ tictactoe/ # Tic Tac Toe game
โ โ โโโ 1024/ # 1024 puzzle game
โ โโโ profile/ # User profile components
โโโ pages/ # Next.js pages and API routes
โ โโโ api/ # Backend API endpoints
โ โโโ auth/ # Authentication pages
โ โโโ games/ # Game container pages
โ โโโ admin/ # Admin dashboard pages
โโโ lib/ # Utility libraries
โโโ scripts/ # Database and admin scripts
โโโ styles/ # CSS stylesheets
โโโ public/ # Static assets
โโโ ProjectShowcase/ # Application screenshots
- Password Hashing: All passwords are encrypted using bcrypt
- JWT Authentication: Secure token-based authentication
- HttpOnly Cookies: Prevents XSS attacks on authentication tokens
- Admin Privileges: Role-based access control for sensitive operations
- Input Validation: Server-side validation for all user inputs
- MongoDB Security: Parameterized queries prevent injection attacks
npm run build
npm startEnsure all production environment variables are properly configured:
- MongoDB connection string
- JWT secret key
- Any additional API keys
The application handles database schema automatically. For production:
- Ensure MongoDB Atlas cluster is configured
- Run admin setup scripts if needed
- Verify all collections are properly indexed
This project is developed as part of the Advanced Programming course (Spring 2025). All rights reserved to the development team.
Note: This README.md was generated with the help of AI.
GameSpace - Where Gaming Meets Modern Web Technology ๐ฎโจ






.png)