Skip to content

Configuration

Whatomate uses a TOML configuration file for all settings. By default, it looks for config.toml in the current directory.

Configuration File

# Application settings
[app]
environment = "development" # development, production
debug = true
# Server settings
[server]
host = "0.0.0.0"
port = 8080
read_timeout = 30
write_timeout = 30
# Database settings
[database]
host = "localhost"
port = 5432
user = "whatomate"
password = "your-password"
name = "whatomate"
sslmode = "disable"
# Redis settings
[redis]
host = "localhost"
port = 6379
password = ""
db = 0
# JWT settings
[jwt]
secret = "your-jwt-secret-key"
access_expiry_mins = 15
refresh_expiry_days = 7
# Storage settings
[storage]
type = "local" # local or s3
local_path = "./uploads"

Environment Variables

Configuration values can be overridden using environment variables:

VariableDescription
WHATOMATE_ENVEnvironment (development/production)
WHATOMATE_DATABASE_HOSTDatabase host
WHATOMATE_DATABASE_PORTDatabase port
WHATOMATE_DATABASE_USERDatabase user
WHATOMATE_DATABASE_PASSWORDDatabase password
WHATOMATE_DATABASE_NAMEDatabase name
WHATOMATE_REDIS_HOSTRedis host
WHATOMATE_REDIS_PORTRedis port
WHATOMATE_JWT_SECRETJWT signing secret

Database Setup

PostgreSQL

Terminal window
# Create database
createdb whatomate
# Or using psql
psql -c "CREATE DATABASE whatomate;"

Run Migrations

Terminal window
./whatomate server -migrate

WhatsApp API Configuration

Configure your WhatsApp Business API credentials in the application settings after logging in:

  1. Navigate to SettingsAccounts
  2. Click Add Account
  3. Enter your credentials:
    • Phone Number ID - From Meta Business Suite
    • Business Account ID - From Meta Business Suite
    • Access Token - Generated in Meta for Developers
    • Webhook Verify Token - Your custom verification token

Building

Development Build

Terminal window
make build # Backend only (no frontend embedded)

For development, run backend and frontend separately:

  • Backend: make run or ./whatomate server
  • Frontend: cd frontend && npm run dev

Production Build

Terminal window
make build-prod # Single binary with embedded frontend

This creates a self-contained binary that serves both API and frontend.

CommandFrontendUse Case
make buildNot embeddedDevelopment
make build-prodEmbeddedProduction

CLI Reference

Whatomate uses a single binary with subcommands:

Terminal window
./whatomate <command> [options]

Commands

CommandDescription
serverStart the API server (with optional embedded workers)
workerStart background workers only (no API server)
versionShow version information
helpShow help message

Server Options

Terminal window
./whatomate server [options]
-config string Path to config file (default "config.toml")
-migrate Run database migrations on startup
-workers int Number of embedded workers, 0 to disable (default 1)

Worker Options

Terminal window
./whatomate worker [options]
-config string Path to config file (default "config.toml")
-workers int Number of workers to run (default 1)

Deployment Scenarios

All-in-One (Simple)

Run API and workers in a single process:

Terminal window
./whatomate server

Separate API and Workers (Scalable)

Run API server without embedded workers:

Terminal window
./whatomate server -workers=0

Run workers on separate machines:

Terminal window
./whatomate worker -workers=4

Docker Compose

Terminal window
# Start all services
docker-compose up -d
# Scale workers
docker-compose up -d --scale worker=3

Production Recommendations

For production deployments:

  • Set environment = "production" and debug = false
  • Use strong, unique values for jwt.secret
  • Enable SSL for database connections (sslmode = "require")
  • Use Redis authentication in production
  • Configure proper firewall rules
  • Set up SSL/TLS termination (nginx, Caddy, or cloud load balancer)
  • Consider running API and workers separately for better scaling