Skip to content

pajavilc/multiplayerTicktacktoe

Repository files navigation

Ticktacktoe Server

An online ticktacktoe game. Live demo here.

Table of Contents

general information

A multiplayer ticktacktoe game running on react + node.js + mysql. This is my personal project made for educational purposes.

features

  • 1 v 1 ticktacktoe
  • spectator mode
  • chat
  • statistics

screenshots

technologies Used

  • Node.js - 16.14.1
  • mariadb - 10.5
  • express - 4.17.2
  • jsonwebtoken - 8.5.1
  • react - 17.0.2
  • cors - 2.8.5
  • redux - 4.1.2
  • ws

setup

First, you need to install MySQL and set it up. The file createTables.session.sql in the DATABASE folder contains two query commands with which you can create necessary database tables.

You also need to install NodeJS from here.

Next you have to create .env in server and include all of the variables from .env.example:

Example:


- ACCESS_SECRET_TOKEN='longSequenceOfChars'

`- REFRESH_SECRET_TOKEN='longSequenceOfChars'`

- ACCESS_EXPIRATION_TIME='2h'

- REFRESH_EXPIRATION_TIME='15d'

- REFRESH_EXPIRATION_TIME_COOKIE=1296000

- DB="name_of_database"

- DBhost="database_host_address"

- DBport=3306

- DBuser="user_name"

- DBpassword= "password"

- NODE_ENV= "development" || "production"

- MAXNUMBEROFGAMES=12

Next you have to install the modules, build react app and move it to server folder and run the server. You can do that by running npm run install-modules, npm run build-react and npm run run-server (or you can use npm run initial) from base location.

Note: Production build needs an ssl cert and private key included in ssl folder (+ SSLPORT= var in .env)

project Status

Project is: in progress

acknowledgements

This project is using icons from freeiconshop.com

Many thanks to Web Dev Simplified for his tutorials and tips regarding js and css.

contact

Created by pajavilc - feel free to contact me!