Skip to main content

Prerequisites

Before installing KAIU Natural Living, ensure you have the following software installed:
Make sure all prerequisite versions match the requirements below to avoid compatibility issues.
  • Node.js: v20 or higher
  • PostgreSQL: v14+ with pgvector extension enabled
  • Redis Server: v6+ (local or remote)
  • Git: For cloning the repository

Verify Prerequisites

Check your installed versions:
node --version  # Should be v20.x.x or higher
psql --version  # PostgreSQL 14 or higher
redis-server --version  # Redis 6 or higher

Installation Steps

1

Clone the Repository

Clone the KAIU Natural Living repository to your local machine:
git clone https://github.com/your-org/kaiu-natural-living.git
cd kaiu-natural-living
2

Install Dependencies

Install all required Node.js packages using npm:
npm install
This will install all dependencies listed in package.json, including:
  • Frontend libraries (React, Vite, TailwindCSS)
  • Backend frameworks (Express, Prisma)
  • AI/ML packages (LangChain, Anthropic)
  • Queue management (BullMQ, Redis)
  • Payment integration (Wompi)
3

Configure Environment Variables

Create environment configuration files:
# Create .env.local for application config
touch .env.local

# Create prisma/.env for database config
mkdir -p prisma
touch prisma/.env
See the Environment Variables page for complete configuration details.
At minimum, add the following to .env.local:
# Database
DATABASE_URL="postgresql://user:password@localhost:5432/kaiu_db"

# Redis
REDIS_HOST="localhost"
REDIS_PORT="6379"

# AI
ANTHROPIC_API_KEY="your-anthropic-api-key"
4

Set Up the Database

Initialize the PostgreSQL database with Prisma:
# Push schema to database
npx prisma db push

# (Optional) Seed initial data
npm run seed
Make sure PostgreSQL is running and the DATABASE_URL is correctly configured before running these commands.
The seed command will populate your database with:
  • Sample products and inventory
  • Admin user accounts
  • Knowledge base entries for RAG
5

Start the Development Environment

KAIU includes a magic script to start all services simultaneously:
./START_ALL.sh
This script will:
  • Start Redis server
  • Launch the backend API on port 3001
  • Start the Vite development server for the frontend
  • Initialize BullMQ workers for WhatsApp queue processing
Alternatively, you can start services individually:
# Terminal 1: Start Redis (if not using system service)
redis-server

# Terminal 2: Start Backend API
npm run api:dev

# Terminal 3: Start Frontend
npm run dev
6

Verify Installation

Once all services are running, verify the installation:You should see:
🚀 Servidor API + Socket.IO corriendo en http://localhost:3001
📡 WebSocket listo para conexión.

Post-Installation

Create Admin User

If you skipped the seed step, create an admin user manually:
node backend/seed-users.js

Test API Endpoints

Test that the API is responding:
# Get products
curl http://localhost:3001/api/products

# Check server health
curl http://localhost:3001/api/admin/dashboard-stats

Common Issues

If port 3001 or 5173 is already in use:
# Find and kill process on port 3001
lsof -ti:3001 | xargs kill -9

# Find and kill process on port 5173
lsof -ti:5173 | xargs kill -9
Ensure PostgreSQL is running and accessible:
# Test PostgreSQL connection
psql -h localhost -U your_user -d kaiu_db

# If connection fails, check PostgreSQL service
sudo systemctl status postgresql
Verify Redis is running:
# Check Redis status
redis-cli ping
# Should return: PONG

# Start Redis if not running
redis-server
If you encounter module errors, clear and reinstall:
rm -rf node_modules package-lock.json
npm install

Next Steps

Database Setup

Configure PostgreSQL and enable pgvector for RAG functionality

Environment Variables

Complete guide to all configuration options

WhatsApp Integration

Set up WhatsApp Cloud API for customer messaging

Redis Setup

Configure Redis for queue management

Build docs developers (and LLMs) love