This is a project using Phoenix framework and Phaser to make a multiplayer snake game, inspired by vimsnake.com
Live demo can be found on snake.theanht1.dev or Heroku
- Elixir 1.19 or later
- Erlang 28 or later
- Node.js v22
- PostgreSQL
- Install package
mix deps.get
cd assets && npm i && cd ..
- Create and migrate database
mix ecto.create
mix ecto.migrate
- Start dev server
mix phx.server
Now you can visit localhost:4000 from your browser.
The easiest way to run the application is using Docker Compose, which will set up both the Phoenix app and PostgreSQL database:
- Generate a secret key base (required for production):
mix phx.gen.secret-
Update
docker-compose.ymlwith the generated secret key (replaceSECRET_KEY_BASEvalue) -
Start the application:
# Build and start both services
docker-compose up
# Or run in detached mode (background)
docker-compose up -d- View logs:
docker-compose logs -f web- Stop the application:
# Stop services
docker-compose down
# Stop and remove database volumes (clean slate)
docker-compose down -vThe application will be available at localhost:4000.
Note: The Docker setup automatically runs database migrations on startup.
You can follow this instruction to configure for production
- Persist username to local storage
- Improve snake head visualization
- Re-enable login feature (with FB or Google) for reserving username and saving personal highscore
- Add unit tests