Skip to main content
KAIU Natural Living Hero Light

What is KAIU Natural Living?

KAIU Natural Living is a modern SaaS e-commerce platform that combines the power of React, Node.js, and PostgreSQL with an intelligent AI orchestrator for WhatsApp customer service. The platform enables seamless product management, order processing, and customer engagement through automated AI responses and human handover capabilities.

Quickstart Guide

Get your first order placed in under 5 minutes

Architecture Overview

Understand the tech stack and system design

AI Orchestrator

Learn how the WhatsApp AI chatbot works

API Reference

Explore the REST API endpoints

Key Features

AI-Powered WhatsApp Integration

The platform features an intelligent AI orchestrator built on Anthropic Claude 3 Haiku and LangChain that handles customer inquiries through WhatsApp automatically.
// From backend/services/ai/Retriever.js
export async function generateSupportResponse(userQuestion, chatHistory = []) {
  const recentHistory = chatHistory.slice(-4);
  const chatLog = recentHistory.map(m => {
    const cleanContent = m.content.replace(/\n\n_🤖 Asistente Virtual KAIU_$/g, '');
    return m.role === 'user' ? new HumanMessage(cleanContent) : new AIMessage(cleanContent);
  });

  const modelWithTools = getChatModel().bindTools(tools);
  let aiMessage = await modelWithTools.invoke(messages);
  
  // Process tool calls for inventory search and knowledge base
  if (aiMessage.tool_calls && aiMessage.tool_calls.length > 0) {
    for (const toolCall of aiMessage.tool_calls) {
      if (toolCall.name === "searchInventory") {
        toolResultStr = await executeSearchInventory(toolCall.args.query);
      }
    }
  }
  
  return { text: aiMessage.content + "\n\n_🤖 Asistente Virtual KAIU_" };
}
The AI orchestrator automatically handles product inquiries, inventory searches, and can seamlessly hand over to human agents when requested.

Real-Time Dashboard with Socket.IO

Monitor and manage WhatsApp conversations in real-time through the admin dashboard.
server.mjs
// Socket.IO Events
io.on('connection', (socket) => {
  console.log('🔌 Dashboard Client Connected:', socket.id);

  socket.on('join_session', (sessionId) => {
    socket.join(`session_${sessionId}`);
  });
});

// Emit new messages to dashboard
io.to(`session_${session.id}`).emit('new_message', { 
  sessionId: session.id, 
  message: { role: 'user', content: text, time: "Just now" } 
});

Complete E-Commerce Workflow

1

Product Management

Manage your product catalog with SKU tracking, inventory control, and multimedia support
2

Order Processing

Handle orders from creation through delivery with multiple payment methods (COD, Wompi, Transfer)
3

Logistics Integration

Automated shipping quote generation and label creation with Venndelo and other carriers
4

Customer Communication

AI-powered WhatsApp responses with automatic handover to human agents

Platform Capabilities

The platform supports four distinct user roles:
  • CUSTOMER: End users who place orders
  • ADMIN: Business owner with full access
  • WAREHOUSE: Logistics staff managing inventory and shipments
  • SUPPORT: Agents handling WhatsApp chats and knowledge base
schema.prisma
enum Role {
  CUSTOMER
  ADMIN
  WAREHOUSE
  SUPPORT
}
Real-time inventory management with reserved stock tracking:
model Product {
  stock         Int     @default(0) 
  stockReserved Int     @default(0)
  isActive      Boolean @default(true)
  
  // Logistics dimensions for shipping quotes
  weight        Float   @default(0.2)
  width         Float   @default(10)
  height        Float   @default(10)
  length        Float   @default(10)
}
Comprehensive order lifecycle management:
  • PENDING → CONFIRMED → PROCESSING → READY_TO_SHIP
  • PICKUP_REQUESTED → SHIPPED → DELIVERED
  • Alternative flows: CANCELLED, RETURNED
Each order maintains snapshots of customer information and shipping addresses for historical accuracy.
Vector-based semantic search using PostgreSQL pgvector extension:
model KnowledgeBase {
  id        String   @id @default(uuid())
  content   String   @db.Text
  metadata  Json?
  embedding Unsupported("vector(1536)")
}
The AI can search company policies, shipping times, and product information to provide accurate responses.

Privacy & Compliance

All customer conversations automatically filter PII (Personally Identifiable Information) before storing in AI context windows. Emails and phone numbers are redacted in chat history for privacy protection.
backend/whatsapp/queue.js
import { redactPII } from '../utils/pii-filter.js';

// Redact PII before storing in history
const cleanText = redactPII(text);
const userMsg = { role: 'user', content: cleanText };
history.push(userMsg);

Technology Stack

Frontend

React 18 + Vite + TailwindCSS

Backend

Node.js + Express + Socket.IO

Database

PostgreSQL + Prisma ORM

Queue System

BullMQ + Redis

AI Engine

Anthropic Claude + LangChain

Messaging

WhatsApp Cloud API

Next Steps

Ready to get started? Follow our quickstart guide to set up your development environment and place your first order.

Continue to Quickstart

Set up KAIU Natural Living in 5 minutes

Build docs developers (and LLMs) love