Skip to content

Deployment

Follow these steps to launch the KAI-Flow stack.

Quick Start with Docker

Step 1 — Configure Environment Variables

Rename .env.example to .env in the project root directory and update the values as needed.

Step 2 — Start the Backend & Frontend

Bash
docker compose up -d

Once running, open:

Local Development (Python venv / Conda)

Prerequisites

  • Python 3.11
  • Node.js ≥ 18.15

Step 1 — Configure Environment Variables

Rename .env.example to .env in the project root directory and update the values as needed.

Step 2 - Edit Constant in .env file

Bash
Replace host.docker.internal with 127.0.0.1 in the DATABASE_URL variable in the .env file.

Step 3 — Set Up a Python Environment

Bash
python -m venv .venv

# Windows (Command Prompt)
.venv\Scripts\activate

# macOS / Linux
source .venv/bin/activate

pip install --upgrade pip
pip install -r backend/requirements.txt

Option B — Conda

Bash
conda create -n kai-flow python=3.11 -y
conda activate kai-flow
pip install -r backend/requirements.txt

Step 4 — Start PostgreSQL

Bash
docker run --name kai \
  -e POSTGRES_DB=kai \
  -e POSTGRES_USER=kai \
  -e POSTGRES_PASSWORD=kai \
  -p 5432:5432 \
  -d postgres:15

Step 5 — Initialize the Database Schema

Ensure your PostgreSQL container is running, then:

Bash
python backend/migrations/database_setup.py

Step 6 — Run the Backend

Bash
python backend/main.py

Step 7 — Run the Frontend (open another terminal)

Bash
cd client
npm install
npm run dev

Open the printed Vite URL (e.g. http://localhost:5173)


SSL Certificates (Optional)

To run the backend with HTTPS locally, generate self-signed certificates:

Bash
cd backend/cert

# Windows (PowerShell)
$env:OPENSSL_CONF="C:\Program Files\Git\usr\ssl\openssl.cnf"; openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -days 365 -nodes -subj "/C=TR/ST=Istanbul/L=Istanbul/O=KAI/OU=Dev/CN=localhost"

# macOS / Linux
openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -days 365 -nodes -subj "/C=TR/ST=Istanbul/L=Istanbul/O=KAI/OU=Dev/CN=localhost"

Widget (Embeddable)

A standalone chat widget for embedding KAI‍Flow agents into other sites.

Bash
cd widget
npm install
npm run dev