A scalable, type-safe WhatsApp bot template built with TypeScript and Baileys. Designed for maintainability and developer experience—no stress, just clean code.
- Strict TypeScript - Full type safety with interfaces for commands, middlewares, and messages
- Modular Architecture - Easy to scale from a handful of commands to hundreds
- Middleware Pipeline - Reusable checks for auth, permissions, rate limiting
- Arona CLI - Scaffold new commands in seconds
- Low Cortisol Development - Clear patterns, predictable structure, no magic
Here is a detailed list of the bot's commands and their functionalities:
General:
menu: Display the main menu.ping: Check the bot's responsiveness.sticker: Create a sticker from an image.
Utility:
afk: Set yourself as AFK (Away From Keyboard).
Middlewares:
checkAfk: Automatically replies when a user is AFK.
- Clone the repository:
git clone https://github.com/fiandev/baileys-starter.git
- Install FFmpeg (required for media processing):
- Ubuntu/Debian:
sudo apt install ffmpeg - macOS:
brew install ffmpeg - Windows: Download from ffmpeg.org
- Ubuntu/Debian:
- Install dependencies using your favorite package manager:
npm install # or pnpm install # or yarn install # or bun install
- Create a
.envfile from.env.example:cp .env.example .env
- Build and run the container:
docker-compose up --build
To stop the container:
docker-compose down- Build the project:
npm run build
- Start the bot:
or with pnpm:
npm run start
or with bun:pnpm start
bun run start:bun
Arona is a CLI tool to quickly generate files for your bot.
bun arona make:<type> <Name>| Type | Output Directory |
|---|---|
command |
src/commands |
config |
src/config |
middleware |
src/middlewares |
helper |
src/helpers |
utils |
src/utils |
Create a new command:
bun arona make:command PingCreate a new middleware:
bun arona make:middleware CheckOwnerCreate a new config:
bun arona make:config ApiKeyAll commands and middlewares must be registered in src/registry.ts:
export const commands = [ping, sticker, menu, afk];
export const middlewares = [checkAfk];Commands are executed when a user sends a message matching the command name or aliases.
Middlewares are executed before every command. They can validate requests, modify data, or block execution by returning false. Useful for: authentication, permission checks, rate limiting, etc.
Commands are defined using the Command interface:
import { type Command } from "../../types/Command";
export const myCommand: Command = {
name: "mycommand",
description: "Description here",
usage: "<args>",
cmd: ["mycommand", "alias"],
category: "general",
isMedia: false,
isOnlyOwner: false,
isOnlyGroup: false,
isOnlyAdmin: false,
isPremium: false,
isAuth: false,
async execute(sock, msg, args) {
// Your logic here
},
};Middlewares are defined using the Middleware interface:
import { type Middleware } from "../../types/Middleware";
export const myMiddleware: Middleware = {
name: "mymiddleware",
async execute(sock, msg) {
// Return true to continue, false to block
return true;
},
isAuth: false,
isGroupOnly: false,
isOnlyOwner: false,
isOnlyAdmin: false,
};This template uses two configuration sources:
- Rename
.env.exampleto.env. - Fill in the required environment variables.
The primary static configuration is located in src/config/bot.ts. Edit this file to customize your bot's behavior:
export const bot = {
botName: "<your bot name>",
authorName: "fiandev",
prefix: /^(!|\/|\.|\$)/, // !, /, ., $
argsSeparator: /(\,|\||\s)/, // , | space
delayMessage: 1000, // 1s or 1000ms
authors: ["<your phone number>"], // 629xxxxxxxxxx
privateParticipants: ["xxxxxxxxxx@lid"], // xxxxxxxxx@lid
privateGroups: ["xxxxxxxxxx@g.us", "xxxxxxxxxx@g.us"], // xxxxxxxxxx@g.us
nsfw: false,
notifyChannels: ["xxxxxxxxxx@g.us"], // xxxxxxxxxx@g.us
premiums: ["<your phone number>"], // 629xxxxxxxxxx
botNumber: "<your phone number>", // 629xxxxxxxxxx
ephemeral: 86400, // 86400 = 1 day
};.
├── src
│ ├── commands # Command handlers
│ ├── config # Static configurations
│ ├── exceptions # Custom exceptions
│ ├── helpers # Helper functions
│ ├── includes # Included modules
│ ├── lib # Libraries
│ ├── middlewares # Middleware handlers
│ ├── types # TypeScript types
│ └── utils # Utility functions
├── types # Global type definitions
├── index.ts # Entry point
└── ...
Contributions are welcome! Please feel free to open an issue or submit a pull request.
MIT License - see LICENSE file.