Skip to content

Real-time multiplayer chess server based on Node + Express + MongoDB

License

Notifications You must be signed in to change notification settings

yalamber/chesshub.io

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

About ChessHub.io

![Gitter](https://badges.gitter.im/Join Chat.svg)

ChessHub.io is an attempt to make a non trivial real-time multiplayer gaming web application using the following technologies:

Client side

Server side

Why Chess?

  • Because it is a good use case for real-time multiplayer gaming
  • Because every time you look for a real-time application example on the web, you end up on chat applications, so I decided to change the subject :-)
  • Because I am a chess junkie!

Goals

The goal of ChessHub.io is not to provide a fully featured web application to play chess but to provide a non trivial application serving as an example of modern web application using the aforementioned technologies.

Apart from chess logic, here is a list of reusable features:

  • Application structure and setup
  • User authentication and registration process (/login & /register)
  • Real time multiplayer gaming logic (See gaming logic section)
  • RESTful API (/api)
  • Real time monitoring dashboard (/monitor)
  • "TV" page to broadcast any real-time content (/tv)

Even though the application is related to chess, it is easy to change the domain model along with application logic and keep/adapt the application structure.

Gaming logic

ChessHub.io uses a simple gaming sequence through Socket.io that works for 2+ players. Here is a simplified diagram of most relevant events:

chesshub.io

Build and Run the application

Prerequisites

  • Node JS
  • Mongo DB up and running on the default port (27017) and using the default database (test)

Run the application

$> npm install
$> node initData.js
$> node .

Browse the following address: http://localhost:3000

You can register a new account or sign in with the following credentials: [email protected] / foobar

Note: The initData.js script will populate Mongo DB with some data so you can use the application.

Screen shots

Home page

home

Playing chess in real time

play

Watch live game

tv

Real time monitoring dashboard

monitor

Contribution

I made ChessHub.io primarily to learn how to make this kind of real-time applications with a non hello world use case.

I am aware of the excellent MEAN.io project, but I decided to go from the ground up without code generation to understand how things work behind the scene.

I am not an expert in all these technologies, so there are probably some points of improvement in the application design, structure or code.

If you believe there is best practice I have not followed, please let me know by opening an issue on the issue tracker. Pull requests are welcome!

License

ChessHub.io is released under the MIT license (see LICENSE file).

About

Real-time multiplayer chess server based on Node + Express + MongoDB

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 53.5%
  • CSS 46.5%