YaariAPI Installation Guide
This guide will walk you through installing YaariAPI and its dependencies, including PostgreSQL, WhatsApp API setup, and running the backend/frontend.
Step 1: Prerequisites
Before installing, ensure you have the following installed:
- Node.js: v22.x or higher
Check:
node -v
- npm: v8.x or higher (or use Yarn/Pnpm)
Check:
npm -v
- PostgreSQL: v13.x or higher
Check:
psql --version
- Git: For cloning the repository
Check:
git --version
- WhatsApp Business API account: Approved account from Meta or a WhatsApp Business Solution Provider (BSP)
Step 2: Clone the Repository
git clone https://github.com/YaariAPI/YaariAPI.git
cd YaariAPI
Step 3: Set Up Environment Variables
Create .env
files in both packages/server
and packages/frontend
directories.
Backend - packages/server/.env
DB_HOST= 'localhost'
DB_PORT= 5432
DB_USERNAME= 'your_db_username'
DB_PASSWORD= 'your_db_password'
DB_DATABASE= 'mydb'
PG_DATABASE_URL=postgres://your_db_username:your_db_password@localhost:5432/mydb
PORT: 3000
WEBSOCKET_PORT= 4000
Frontend - packages/frontend/.env
VITE_BACKEND_URL='http://localhost:3000'
VITE_WEBSOCKET_URL='http://localhost:4000'
Step 4: Install Dependencies
Check yarn
is already install or not.If not then first install yarn.
Packages
cd .. # Make sure you are in packages directory.
yarn install
Backend
cd server
yarn install
Frontend
cd ../fronted
yarn install
Step 5: Set Up the Database
Run Migrations (if using TypeORM migrations):
cd packages/server
yarn start
yarn database:migrate:prod
yarn start
yarn database:migrate:run
Step 6: Configure WhatsApp Webhook
- Ensure your server is publicly accessible (e.g., using
ngrok
). - Log into your WhatsApp BSP or Meta Business Manager.
- Set webhook URL to
http://localhost:3000/webhook
(or your production URL). - Use the
WEBHOOK_VERIFY_TOKEN
. - Subscribe to message events.
Step 7: Start the Backend Server
In a new terminal:
cd packages/server
yarn run start
Now Backend Server runs at http://localhost:3000
,( GraphQL at /graphql
, Webhook at /webhook
) and Socket.IO at ws://localhost:8080
.
Step 8: Start the Frontend
In a new terminal:
cd packages/fronted
yarn run dev
Frontend app available at http://localhost:5173
Step 9: Verify the Setup
- Visit
http://localhost:5173
in browser. - Test GraphQL at
http://localhost:3000/graphql
. - Send a test message to your WhatsApp number.
- Check if it appears in the app.
- Try bulk messaging via uploading contact list.