https://playgomoku.netlify.app/
MERN site that allows users to signup/login and play Gomoku online. Find, create, and play against others for rating. Rating is displayed on a leaderboard so you can see how your skills rank amongst everyone else!.
Uses long pro variation to make the game more fair.
- MERN
- MongoDB Atlas as database
- Express and NodeJS as backend
- React as fronend
- SocketIO as real-time communcation
- Accounts
- Create and store profile and ratings in a database
- Avatars created from DiceBear Avatars API
- Username checking to see if taken or not
- Login from anywhere to play
- Signout to stay secure
- Browse as guest (but won't be able to play)
- Create and store profile and ratings in a database
- Game and Room
- Join an available game
- If no games are available then a new game will be created
- Create custome game
- Make your own game and invite or wait for others to join
- Error checking to see if a roomname is taken
- Password option to make a room private
- Game's roomname created from Random Word Api so that no roomnames are the same
- Display list of rooms
- roomname, playercount, password required, and actions
- Actions include:
- If a room is not filled, then a Join button is shown
- If a room is filled, then a In session button is shown
- Filtering of rooms to allow for easy search
- After a game is made or finished, the rooms are updated for real time viewing
- Join an available game
- Leaderboard
- Display list of users
- username, avatar, rating
- Filtering of users to allow for easy search
- Local Play
- Leaving a game while unfinished will cause the leave to be penalized and the remaining player to be notified of their leave
- Leaving a game before it has started will prompt the user, if the user continues, then the lobby will be updated accordingly
- React Error Boundary
-
Frontend
- React
- React Router Dom for navigation
- useContext, useReducer for state management
- Axios
- Retrieve information from server and API's
- TailWindCss
- UI, aesthetics, responsive design
- Error handling
- Random Word Api
- DiceBear Avatars API
- React
-
Backend
- Express
- bycryptjs
- Securely hash a user's password for security
- nodemon
- Autoreload when changes to server
- dotenv
- Hides secrets
- cors
- Avoid cors errors
- Body-parser
- Correctly parse JSON for information retrieval and usage
-
Database
- MongoDB Atlas
- Mongoose for Object Data Modeling of MongoDB
- MongoDB Atlas
-
SocketIO
- Real-time communication between clients <-> clients and clients <-> server
Get the source code:
git clone https://github.com/minh100/Gomoku.git
cd Gomoku
Install all dependecies at the root of the repo:
npm install
At the root of the repo push to Git:
cd Gomoku
git add .
git commit
git push origin master
- To update server do step 4 of Deploying to Server-side
- To update client do Actual Deployment and New Deployments of Deploying to Client-side
- Inital Deployment Setup
- At the client folder install Netlify CLI
npm install netlify-cli -g
- In package.json, add a homepage property
"homepage": ".",
- Then to fix the issue of client-side rendering, navigate to client/public and add a plain text _redirects file with the text
/* /index.html 200
- At the client folder install Netlify CLI
- Actual Deployment and New Deployments
- Build the app (make sure you are in the client folder)
npm run build
- Predeploy to see if the site is how you want it (choose build as the publishing directory)
netlify deploy
- Deploy to production (choose build as the publishing directory)
netlify deploy --prod
- Build the app (make sure you are in the client folder)
- Since we are using Heroku to deploy the backend server, we need to take into consideration of the subfolders we want to deploy
- In this case we only want to deploy the server folder
- Create a Heroku app
- Navigate to root of repo
- Create the heroku remote using the command
heroku git:remote -a <heroku_url>
- Now still at the root of the repo, run
git subtree push --prefix <pathToSubfolder> heroku master
As an examaple we only want to deploy the server folder
git subtree push --prefix server heroku master
- In this case we only want to deploy the server folder
- Heroku Reference