{"id":21672367,"url":"https://github.com/redis-developer/hangman-game-redis","last_synced_at":"2026-04-13T06:39:44.599Z","repository":{"id":263876214,"uuid":"891597437","full_name":"redis-developer/hangman-game-redis","owner":"redis-developer","description":"Hangman game written in JavaScript and backed by Java and Redis. It can be deployed locally or on AWS.","archived":false,"fork":false,"pushed_at":"2024-12-21T17:58:10.000Z","size":1945,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-01-25T09:27:30.580Z","etag":null,"topics":["aws","docker","java","javascript","jedis","redis","redis-cloud","terraform"],"latest_commit_sha":null,"homepage":"","language":"HCL","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/redis-developer.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-11-20T16:02:46.000Z","updated_at":"2024-12-21T17:58:13.000Z","dependencies_parsed_at":"2024-12-20T01:45:29.698Z","dependency_job_id":null,"html_url":"https://github.com/redis-developer/hangman-game-redis","commit_stats":null,"previous_names":["redis-developer/hangman-game-redis"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redis-developer%2Fhangman-game-redis","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redis-developer%2Fhangman-game-redis/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redis-developer%2Fhangman-game-redis/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redis-developer%2Fhangman-game-redis/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/redis-developer","download_url":"https://codeload.github.com/redis-developer/hangman-game-redis/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244576919,"owners_count":20475211,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aws","docker","java","javascript","jedis","redis","redis-cloud","terraform"],"created_at":"2024-11-25T13:29:09.977Z","updated_at":"2026-04-13T06:39:39.546Z","avatar_url":"https://github.com/redis-developer.png","language":"HCL","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Hangman Game with Redis\n\nHangman is a popular game of guessing. One player thinks of a word, and then provides the participants with a hint about the word, as well as how many letters it contains. It was super fun at school during recess times. But guess what? It can still be fun if you play against a machine and collaboratively with your friends. Meet Hangman game with Redis.\n\n![game.png](images/game.png)\n\nThis is the Hangman game written in JavaScript for the frontend, and uses [Java](https://openjdk.org) and [Redis](https://redis.io) for the backend. Once deployed, multiple users can play simultaneously, while a real-time scoreboard is computed based on the plays.\n\n## 🏠 Deploying locally\n\nTo deploy this game locally, you will need to have the following pre-requisites:\n\n* **[Docker](https://www.docker.com)**: to pull images and create the containers with the services.\n\n### Steps\n\n#### 1. Executing the services\n\nGo to the root directory from this project where the file `docker-compose.yml` is located and execute the following command:\n\n```bash\ndocker compose up -d\n```\n\nOnce the services finish starting up, you can access the game in the following URL:\n\nhttp://localhost:8080/hangman-game-redis\n\nTo stop the services, execute the following command:\n\n```bash\ndocker compose down\n```\n\n## ☁️ Deploying on AWS\n\nTo deploy this game on AWS, you will need to have the following pre-requisites:\n\n* **[Java 17](https://openjdk.org)**: to compile and build Lambda functions and backend APIs.\n* **[Maven](https://maven.apache.org/download.cgi)**: to build the project and create the deployment archive.\n* **[Terraform](https://developer.hashicorp.com/terraform/install)**: to create all the resources and required configuration.\n* **[Redis Cloud](https://redis.io/cloud/)**: for the Redis database to store the game data. \n* **[AWS Account](https://portal.aws.amazon.com/billing/signup)**: for resources like S3, Lambda, and API Gateway.\n\n### Steps\n\n#### 1. Defining your Redis Cloud account\n\nDuring deployment, the code will create a new subscription and database in your Redis Cloud account. By default, the subscription will be based on the [30 MB Essentials plan](https://redis.io/docs/latest/operate/rc/subscriptions/view-essentials-subscription/essentials-plan-details/), which is free. This allows you to play with the game without paying a single dime to Redis. If you are wondering whether a `30MB` database size will suffice for you to play the game with thousands of users simultaneously, the answer is yes. In fact, this plan allows you to handle `500,000` users approximately. For anything beyond this, consider a plan with a larger capacity.\n\nIn order for the code to create these resources, it needs to know how to interact with your Redis Cloud account. Therefore, you must export valid API keys from your Redis Cloud account as environment variables before moving further. You can find instructions about how to create your own API keys [here](https://redis.io/docs/latest/operate/rc/api/get-started/manage-api-keys). Then export the following environment variables:\n\n```bash\nexport REDISCLOUD_ACCESS_KEY=\u003cYOUR_REDISCLOUD_ACCESS_KEY\u003e\nexport REDISCLOUD_SECRET_KEY=\u003cYOUR_REDISCLOUD_SECRET_KEY\u003e\n```\n\n#### 2. Execute the deployment\n\nTo deploy the game, go to the `cloud` directory, and execute the following command:\n\n```bash\nsh deploy.sh\n```\n\nThis will start with the compilation of the source-code and the download of the dependencies from Terraform. Keep in mind that in order for the Terraform code to create cloud resources, your AWS credentials must be already set in your environment.\n\nFrom this point on, Terraform will start the deployment of the game on AWS. It may take a few minutes to complete. When it finishes, you will see an output like this:\n\n```bash\nApply complete! Resources: 94 added, 0 changed, 0 destroyed.\n\nOutputs:\n\nGame = \"http://hangman-game-redis-uniquestring.s3-website-us-east-1.amazonaws.com\"\n```\n\nThis is the URL of the game. Share this URL with everybody wanting to play. To undeploy the game and delete the resources created, go to the `cloud` directory, and execute the following command:\n\n```bash\nsh undeploy.sh\n```\n\n## 🚀 Playing the game\n\nThe first thing you will see after opening the game is a text box asking you to specify your player's name. This is a required step. Your name is required to compute the scoreboard.\n\n![set-user.png](images/set-user.png)\n\nAt any time, you can set the player name again by pressing **Shift** + **P**. To close the set player name window, press the **ESC** key.\n\nAfter confirming your name, the game begins. The game is self-explanatory. All you have to do is read the hint provided, and try to guess what word is being asked. Use your mouse or your keyboard to select the characters representing the letter from your guess. If you enter a wrong letter, the hangman will start to build. You have 6 guesses per game. If you find the word, congratulations. A new point will be added to your score. Otherwise, your score will not add up.\n\n![congrats.png](images/congrats.png)\n\nWhether you win or lose, you will always be presented with the option to play again. Just click in the play again button and try one more time. A new word will be picked to you.\n\nTo see the scoreboard, press **Shift** + **S**.\n\n![scoreboard.png](images/scoreboard.png)\n\nTo close the scoreboard window, press the **ESC** key.\n\nThe game also makes available some interesting metrics about the plays from users. To see the metrics, press **Shift** + **M**.\n\n![metrics.png](images/metrics.png)\n\nTo close the metrics window, press the **ESC** key.\n\n## License\n\nHangman Game with Redis is licensed under the **[MIT license](LICENSE)**.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fredis-developer%2Fhangman-game-redis","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fredis-developer%2Fhangman-game-redis","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fredis-developer%2Fhangman-game-redis/lists"}