A modern, multilingual Hangman game built with Go, React, and Firebase. Features responsive design, multiple difficulty levels, and support for English, Ukrainian, and Polish languages.
- ๐ Multilingual Support: English, Ukrainian, and Polish
- ๐ฏ Three Difficulty Levels: Easy, Normal, and Hard
- ๐ก Hint System: Get contextual clues for words
- ๐ค Letter Reveal: Open letters strategically (difficulty-based)
- โจ๏ธ Keyboard Support: Play with physical keyboard or on-screen buttons
- ๐ฑ Fully Responsive: Optimized for mobile and desktop
- ๐จ Beautiful UI: Built with Chakra UI
- โ๏ธ Cloud-Native: Deployed on Firebase Hosting and Google Cloud Run
Try the game live: https://hgame.i-dmytro.org
Frontend:
- React >= 19.0 with TypeScript
- Vite (build tool)
- Chakra UI 2.x (component library)
- react-i18next (internationalization)
- Deployed on Firebase Hosting
Backend:
- Go 1.25
- GIN (Go web framework)
- Deployed on Google Cloud Run
Database:
- Firebase Firestore (NoSQL database)
go-hangman/
โโโ frontend/ # React frontend application
โ โโโ src/
โ โ โโโ components/ # React components
โ โ โโโ hooks/ # Custom React hooks
โ โ โโโ i18n/ # Internationalization configuration
โ โ โโโ locales/ # i18n translations
โ โ โ โโโ en/ # English translations
โ โ โ โโโ ua/ # Ukrainian translations
โ โ โ โโโ pl/ # Polish translations
โ โ โโโ types/ # TypeScript type definitions
โ โ โโโ services/ # Frontend API services
โ โ โโโ theme/ # Custom theme configuration
โ โ โโโ main.ts # Application entry point
โ โ โโโ App.tsx # Main application component
โ โโโ dist/ # Production build output
โ โโโ firebase.json # Firebase Hosting configuration
โ โโโ package.json # Project dependencies
โ
โโโ backend/ # Go backend application
โ โโโ handlers/ # HTTP request handlers
โ โโโ game/ # Game logic
โ โโโ session/ # Session management
โ โโโ utils/ # Utility functions and helpers
โ โ โโโ db_connection/ # Database connection checker
โ โ โโโ seeder/ # Database seeding scripts
โ โ
โ โโโ database.example.json # Example database structure
โ โโโ Dockerfile # Dockerfile for backend application
โ โโโ go.mod # Go module configuration
โ โโโ go.sum # Go module checksum file
โ โโโ main.go # Application entry point
โ
โโโ .github/
โ โโโ workflows/
โ โโโ deploy.yaml # CI/CD pipeline configuration
โ
โโโ README.md
- Node.js 22.20.0 or higher
- Go 1.25 or higher
- Firebase CLI (
npm install -g firebase-tools) - Docker (optional, for containerized development)
git clone https://github.com/dmytropi-dev/go-hangman.git
cd go-hangman- Create a new Firebase project at console.firebase.google.com
- Enable Firestore Database
- Download service account key:
- Go to Project Settings โ Service Accounts
- Click "Generate New Private Key"
- Save as
backend/serviceAccountKey.jsonIMPORTANT: Keep this file secure and do not commit it to version control!
- Initialize Firebase in frontend:
cd frontend
firebase login
firebase init hosting
# Select your Firebase project
# Set public directory to: dist
# Configure as single-page app: YesUse the example database structure (see database.example.json) to create collections for each language (en, ua, pl) and add word documents with the required fields.:
# Import words to Firestore
# You can use Firebase Console or upload via scriptcd backend
# Install dependencies
go mod download
go mod tidy
# Run backend
go run main.goBackend will be available at http://localhost:8080
cd frontend
# Install dependencies
npm install
# Create .env file
echo "VITE_API_URL=http://localhost:8080" > .env
# Run development server
npm run devFrontend will be available at http://localhost:5173
| Difficulty | Attempts | Hints | Open Letters |
|---|---|---|---|
| Easy | 7 | โ | 2 |
| Normal | 5 | โ | 1 |
| Hard | 3 | โ | 0 |
- Select your preferred language and difficulty
- Click letters on the keyboard or type on your physical keyboard
- Use hint to get clue about the word
- On Easy/Normal, you can reveal letters (costs 1 attempt each)
- Guess the word before running out of attempts!
See database.example.json for the complete structure. Each language has its own collection with words containing:
- word: The word to guess
- hint: A clue about the word
Example:
{
"word": "elephant",
"hint": "A large mammal with a trunk",
}The project uses GitHub Actions for automated deployment:
-
On PR merge to
main:- Frontend โ Firebase Hosting
- Backend โ Google Cloud Run
-
Required GitHub Secrets:
FIREBASE_SERVICE_ACCOUNT: Firebase service account keyGCP_SA_KEY: Google Cloud service account keyBACKEND_URL: Backend URL for frontend configurationGCP_PROJECT_ID: Your GCP project IDDOCKERHUB_USERNAME: Docker Hub usernameDOCKERHUB_PASSWORD: Docker Hub access passwordGITHUB_TOKEN: GitHub token for actions (automatically provided)
Frontend:
cd frontend
npm run build
firebase deploy --only hostingBackend:
cd backend
gcloud run deploy hangman-backend \
--source . \
--platform managed \
--region us-central1 \
--allow-unauthenticatedThe game supports three languages with full UI translation:
- English (
en) - Ukrainian (
ua) - Polish (
pl)
- Create translation file:
frontend/src/locales/[lang]/translation.json - Add language to
frontend/src/i18n/config.ts - Add words to Firestore:
data/[lang]/collection - Update language selector in
GameSetup.tsx
| Variable | Description | Example |
|---|---|---|
VITE_API_URL |
Backend API URL | https://your-backend.run.app |
Contributions are welcome! Please follow these steps:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
Dmytro Pishchenkov
- GitHub: @DmytroPI-dev
- Chakra UI for the beautiful component library
- Firebase for hosting and database
- Google Cloud Platform for serverless backend
- The Open Source community
If you have any questions or issues, please open an issue on GitHub.
Happy Gaming! ๐ฎ๐