Before you start the Phoenix server make sure you have set the following environment variables
POSTGRES_USERenvironment variable to your Postgres usernamePOSTGRES_PASSWORDenvironment variable to your Postgres passwordCHESS_SECRET_KEYenvironment variable with the result of themix phx.gen.secretcommand (it generates a secure secret key for the session management in your app)
To start your Phoenix server:
- Run
mix setupto install and setup dependencies - Start Phoenix endpoint with
mix phx.serveror inside IEx withiex -S mix phx.server
Once the server is running you can
- Local machine: visit http://localhost:4000/games (you will be prompted to log in or sign up)
If you would like to access the application from another device in your local network you should
- Acquire the local IP address of your computer (for example
192.168.1.200)ifconfigfor Linux/macOSipconfigfor Windows
- Substitute localhost with that IP address (for example http://192.168.1.200:4000/games)
Once you have successfully logged in go ahead and press the New Game button to start playing.
However the game won't start unless there are two clients attempting to start a game.
To start open a different browser on your local machine, access the app through it and click New Game. You should see the chessboard on both browsers.
Connecting from an external device as the second client will also work of course.
The game isn't perfect, but it has the essentials
- Timers (synchronized with internal server timers)
- The ability to resign, and offer a draw
- En passant, castling, promotions
- A working move register
- Improve frontend in the game window
- Timer positioning
- Move register
- Background
- Add chatting functionality for players and spectators