Word Ninjas is a multiplayer Telegram group game where players compete to solve anagrams in real-time
Here are the steps to getting your development environment working
- Open Telegram and search for
@BotFather
. - Start a chat and type
/start
. - Type
/newbot
to create a new bot. - Follow the prompts:
- Choose a name for your bot.
- Choose a unique username ending with
bot
(e.g.,mywordbot
).
- You will receive a bot token. Save this token as you’ll use it in your .env file.
- Create a new telegram group.
- Add the bot your new telegram group chat and promote the bot as an admin.
- Send a message to the group chat.
- Visit https://api.telegram.org/bot{YOUR-BOT-TOKEN}/getUpdates in your browser (Note: Input your bot token!)
- From the JSON response, you can see your chat id. Save this chat id as you’ll use it in your .env file.
-
Create a .env file in your root directory
├── src/ │ ├── constants/ # Reusable constant values (e.g Game messages) │ ├── enums/ # TypeScript enums for well-defined sets (e.g Cron Expressions, Seconds Delay) │ ├── handlers/ # Logic to handle different user commands and game interactions (e.g message, start, help commands) │ └── interafces/ # TypeScript interfaces for type-safety │ ├── jobs/ # Background jobs or schedulers (e.g Game rounds restart) │ ├── models # Entities or Data Model (e.g Player, Round Winner) │ ├── services/ # Logic that handles core game processes (contains bot, game, player and words services) │ ├── store # Temporary Data storage (Redis Adapter initialization, default data) │ ├── types # Global or shared TypeScript types │ ├── utils/ # Utility functions (e.g message formatting) │ ├── validations/ # Input validation logic to keep data clean and safe │ └── main.ts/ # Project entry point for boostraping the application ├── .env # Contains environment variables ├── .env.example # Sample environment variable blueprint for development ├── .gitignore # Specifies which files/folders to ignore in Git ├── package-lock.json # Auto-generated lockfile for consistent dependency versions ├── package.json # Project metadata and dependencies └── tsconfig.json # TypeScript configuration
-
Update the .env with the following credentials. Alternative you can take a look at the .env.example in the project root directory to get an intuition on the needed credentials to quick start the development environment.
BOT_TOKEN=your-bot-token ROOM_CHAT_ID=your-room-chat-id REDIS_USERNAME=your-redis-database-username REDIS_PASSWORD=your-redis-database-password REDIS_HOST=your-redis-host-url REDIS_PORT=your-redis-port SUPABASE_ANON_KEY=your-supabase-anon-key SUPABASE_URL=your-supabase-url SUPABASE_PASSWORD=your-supabase-password
-
Run the below command to install all project dependencies
$ npm install
-
Note the following changes in your project root directory after installation
├── dist/ # Contains all the compiled JavaScript code ├── node_modules/ # Contains all the dependencies (libraries and packages) needed. ├── src/ │ ├── other folders/ | |........ │ └── main.ts/ # Project entry point for boostraping the application ├── other root directory files ├── ........... └── tsconfig.json # TypeScript configuration
-
Run the below command to start the development server and visit your telegram group chat
$ npm run start
This project is licensed under MIT LICENSE
Copyright 2025 by Taofeek Abdulazeez