Skip to content

Deployment

Follow these steps to launch the KAI-Flow stack.

1. Configuration (.env)

You must configure the environment variables before starting.

Backend Migrations .env

Create: backend/migrations/.env

Text Only
ASYNC_DATABASE_URL=postgresql+asyncpg://kai:kai@localhost:5432/kai
DATABASE_URL=postgresql://kai:kai@localhost:5432/kai
CREATE_DATABASE=true

Backend Runtime .env

Create: backend/.env

Text Only
ASYNC_DATABASE_URL=postgresql+asyncpg://kai:kai@localhost:5432/kai
DATABASE_URL=postgresql://kai:kai@localhost:5432/kai
CREATE_DATABASE=false
POSTGRES_DB=kai
POSTGRES_PASSWORD=kai
CREDENTIAL_MASTER_KEY=your_secure_encryption_key_here

# LangSmith / LangChain tracing (optional but recommended for debugging)
LANGCHAIN_TRACING_V2=true
LANGCHAIN_API_KEY=your_langchain_api_key
LANGCHAIN_PROJECT=kai-Flow-workflows
LANGCHAIN_ENDPOINT=https://api.smith.langchain.com
ENABLE_WORKFLOW_TRACING=true
TRACE_MEMORY_OPERATIONS=true
TRACE_AGENT_REASONING=true

Frontend .env

Create: client/.env

Text Only
VITE_API_BASE_URL=http://localhost:8000
VITE_API_VERSION=/api/v1 (Derived from VITE_API_START and VITE_API_VERSION_ONLY)
VITE_API_START=api
VITE_API_VERSION_ONLY=v1
VITE_NODE_ENV=development
VITE_ENABLE_LOGGING=true
VITE_BASE_PATH=/kai

2. Start Services

Once your configuration files are ready, open your terminal in the project folder and run this command to start all services:

Bash
docker compose up -d

3. Verify Health

After starting the services, run this command to check if everything is running:

Bash
docker compose ps

Local Installation (Development)

For development purposes or if you prefer running without Docker Compose, you can run the services individually.

Backend Setup

  1. Run Database: You need a registered PostgreSQL instance.

Bash
docker run --name kai -e POSTGRES_DB=kai -e POSTGRES_USER=kai -e POSTGRES_PASSWORD=kai -p 5432:5432 -d postgres:15
2. Setup Python Environment:

Bash
cd backend
python -m venv .venv
# Windows: .venv\Scripts\Activate.ps1 | Linux/Mac: source .venv/bin/activate
pip install -r requirements.txt
3. Initialize DB & Run: Run these commands one by one to set up the database and start the backend:

Bash
python migrations/database_setup.py

Frontend Setup

  1. Install & Run: Open a new terminal, go to the client folder, and run these commands one by one:
Bash
cd client
npm install
npm run dev

When finished, open your browser and go to http://localhost:5173.