Get Started
Installation
Installation
Cette page décrit l'installation locale et via Docker pour nAI'vi.
Assurez-vous de disposer des prérequis ci-dessous avant de commencer.
Prérequis
- Python 3.13+
- Node.js 18+
- bun
- Clé API Mistral
- Docker & Docker Compose
- (Déploiement) kubectl & Helm 3.x+
Installation locale (sans Docker)
1) Cloner et installer (monorepo Bun)
# Cloner
git clone https://gitlab.amplitudes.it/ia/naivi-bots
cd naivi-bots
# Installer toutes les dépendances du workspace
bun installScripts utiles depuis la racine (package.json workspace):
bun run dev:server→ démarre l'API Hono (http://localhost:3000)bun run dev:web→ démarre le front Vite (http://localhost:3001)bun run dev:docs→ démarre la doc Fumadocs (http://localhost:5555)
Alternatives par app:
# Web
cd apps/web
bun install
bun run dev
# Server
cd apps/server
bun install
bun run dev1bis) Dépendances Python (chatbot + document-processor)
# Chatbot
cd apps/chatbot
python -m venv .venv
# Windows PowerShell
. .venv/Scripts/Activate.ps1
python -m pip install -e .
# Document Processor (terminal séparé)
cd apps/document-processor
python -m venv .venv
. .venv/Scripts/Activate.ps1
python -m pip install -e .2) Variables d'environnement
Configurez chaque app avec ses propres fichiers .env:
- Web:
apps/web/.env
VITE_SERVER_URL=http://localhost:3000
VITE_CHATBOT_URL=http://localhost:8501
VITE_BETTER_AUTH_CALLBACK_URL=http://localhost:3001/auth/callback- Server:
apps/server/.env
DATABASE_URL=postgresql://user:password@localhost:5432/naivi
CORS_ORIGIN=http://localhost:3001
BETTER_AUTH_SECRET=changeme
BETTER_AUTH_URL=http://localhost:3000
DOCUMENT_PROCESSOR_URL=http://localhost:8001
INDEX_API_URL=http://localhost:8502
# Resend (email), Microsoft OAuth si utilisés
# RESEND_API_KEY=...
# EMAIL_FROM=...
# MICROSOFT_CLIENT_ID=...
# MICROSOFT_CLIENT_SECRET=...
# MICROSOFT_TENANT_ID=...- Document Processor:
apps/document-processor/.env
DOCUMENT_PROCESSOR_HOST=0.0.0.0
DOCUMENT_PROCESSOR_PORT=8001
MAX_FILE_SIZE_MB=50
ENABLE_OCR=false
LOG_LEVEL=INFO- Chatbot:
apps/chatbot/.env
MISTRAL_API_KEY=your_api_key_here
DATABASE_URL=postgresql://user:password@localhost:5432/naivi
CHAINLIT_SYSTEM_PROMPT="You are a helpful AI assistant."
BOT_SYSTEM_PROMPT="Context: {context}\n\nExamples: {few_shots_examples}\n\nQuestion: {question}"
WEB_APP_BASE_URL=http://localhost:3001
RAG_K_CHUNKS=5
RAG_N_EXAMPLES=4
ENABLE_ORCHESTRATOR=false
CHAINLIT_AUTH_SECRET=changemeNe versionnez pas les fichiers .env et protégez votre MISTRAL_API_KEY.
3) Vérification
# Démarrer l'API serveur (terminal 1)
bun run dev:server
# Démarrer le front (terminal 2)
bun run dev:web
# Démarrer le document-processor (terminal 3)
cd apps/document-processor
. .venv/Scripts/Activate.ps1
uvicorn src.main:app --host 0.0.0.0 --port 8001 --reload
# Démarrer le chatbot Chainlit (terminal 4)
cd apps/chatbot
. .venv/Scripts/Activate.ps1
chainlit run src/chatbot/interfaces/chainlit/app.py -w
# Démarrer l'Index API du chatbot (terminal 5, optionnel)
cd apps/chatbot
uvicorn src.chatbot.interfaces.api.index_api:app --host 0.0.0.0 --port 8502| Service | URL | Health |
|---|---|---|
| Server (Hono) | http://localhost:3000 | GET /health |
| Web (Vite) | http://localhost:3001 | — |
| Document Processor | http://localhost:8001 | GET /health |
| Chatbot (Chainlit) | http://localhost:8501 | — |
| Index API | http://localhost:8502 | GET / |
Installation avec Docker
Le docker-compose.yml orchestre tous les services via Dockerfile.local (multi-stage, avec cache BuildKit).
# Copier et remplir le fichier d'environnement racine
cp .env.example .env
# (Éditer .env avec vos valeurs)
# Construire et démarrer tous les services
docker compose up --build -d
# Vérifier l'état
docker compose psServices Docker
| Service | Image/Target | Port (variable) | Dépendances |
|---|---|---|---|
db | postgres:17-alpine | ${DB_PORT} | — |
document-processor | target document-processor | ${DOC_PROCESSOR_PORT} | db |
index | target index | ${INDEX_API_PORT} | db |
server | target server | ${SERVER_PORT} | db (healthy), index, document-processor |
chatbot | target chatbot | ${CHAINLIT_PORT} | db |
web | target web | ${WEB_PORT} | server, chatbot |
docs | target docs | ${DOCS_PORT:-3002} | — |
Variables .env racine (Docker Compose)
# Ports exposés
SERVER_PORT=3000
WEB_PORT=3001
DOCS_PORT=3002
DB_PORT=5432
DOC_PROCESSOR_PORT=8001
CHAINLIT_PORT=8501
INDEX_API_PORT=8502
# Base de données
DB_USER=naivi
DB_PASSWORD=naivi
DB_NAME=naivi
# Chatbot — branding
BOT_NAME=Kalli
CHAINLIT_PUBLIC_URL=http://localhost:8501
# URLs inter-services (auto-configurées dans compose)
# DOCUMENT_PROCESSOR_URL=http://document-processor:8001 ← injecté par composeVolumes
db-volume— données PostgreSQL (persistées)./i18n.json:/app/i18n.json:ro— fichier i18n monté en lecture seule surserver,chatbot,index,web./data/companies_bt.json:/app/data/companies_bt.json:ro— données chatbot
Entrypoints notables
- chatbot: au démarrage, injecte
BOT_NAMEet l'URL web dans.chainlit/config.toml - web: au démarrage, remplace les placeholders
{{ .Env.VITE_* }}dans les fichiers HTML buildés
Pour rebuilder un seul service: docker compose up --build -d server
Kalli