Skip to main content

Installation

The easiest way to run WA-RS is using Docker Compose:

cd rest-api
docker compose up -d

This will start:

  • PostgreSQL database
  • WA-RS API server

Custom Configuration

Create a .env file to customize settings:

# PostgreSQL
POSTGRES_HOST=postgres
POSTGRES_PORT=5432
POSTGRES_USER=postgres
POSTGRES_PASSWORD=your-secure-password
POSTGRES_DB=wagateway

# JWT
JWT_SECRET=your-super-secret-jwt-key

# Storage
WHATSAPP_STORAGE_PATH=/app/whatsapp_sessions

Then run:

docker compose up -d

Manual Installation

Prerequisites

  • Rust 1.75 or later
  • PostgreSQL 14 or later
  • OpenSSL development libraries

Ubuntu/Debian

# Install dependencies
sudo apt-get update
sudo apt-get install -y \
build-essential \
pkg-config \
libssl-dev \
libsqlite3-dev \
postgresql

# Install Rust
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
source $HOME/.cargo/env

Build

git clone https://github.com/fdciabdul/wa-rs.git
cd wa-rs/rest-api
cargo build --release

Database Setup

# Create database
sudo -u postgres createdb wagateway

# Or connect and create
psql -U postgres -c "CREATE DATABASE wagateway;"

Configuration

cp .env.example .env

Edit .env:

POSTGRES_HOST=localhost
POSTGRES_PORT=5432
POSTGRES_USER=postgres
POSTGRES_PASSWORD=your-password
POSTGRES_DB=wagateway
JWT_SECRET=your-secret-key
WHATSAPP_STORAGE_PATH=./whatsapp_sessions

Run

# Development
cargo run

# Production
./target/release/wa-rs

Environment Variables

VariableDefaultDescription
POSTGRES_HOSTlocalhostPostgreSQL host
POSTGRES_PORT5432PostgreSQL port
POSTGRES_USERpostgresPostgreSQL user
POSTGRES_PASSWORDpostgresPostgreSQL password
POSTGRES_DBwagatewayPostgreSQL database
JWT_SECRET(random)JWT signing secret
WHATSAPP_STORAGE_PATH./whatsapp_sessionsSession storage path
RUST_LOGinfoLog level

Verify Installation

# Health check
curl http://localhost:3000/health
# Should return: OK

# Check Swagger UI
open http://localhost:3000/swagger-ui