Codapult
TarifsPluginsBlogDocsDémo

Le boilerplate SaaS pour les créateurs

© 2026 Codapult. Tous droits réservés.

Built with Codapult

Projet

  • Tarifs
  • Plugins
  • Documentation
  • Comparaison de templates SaaS

À propos

  • Contact

Mentions légales

  • Politique de confidentialité
  • Conditions d'utilisation
Tous les articles

Getting Started

  • Introduction
  • Quick Start
  • Project Structure
  • License and Permitted Use

Configuration

  • Environment Variables
  • App Configuration

Authentication

  • Authentication
  • OAuth Providers
  • Two-Factor & Passwordless
  • Enterprise SSO (SAML)

Database

  • Database
  • Migrations

Teams

  • Teams & Organizations
  • Permissions & RBAC
  • SCIM Provisioning

Payments

  • Payments & Billing
  • Stripe Setup
  • LemonSqueezy Setup
  • Polar Setup
  • Payment Webhooks

Api

  • API Layer
  • tRPC
  • GraphQL

Ai

  • AI Features
  • Streaming Chat
  • RAG and Semantic Search
  • Quotas and Memory

Email

  • Email
  • Email Templates

Infrastructure

  • Infrastructure
  • Self-Hosting
  • File Storage
  • Docker
  • Background Jobs
  • Terraform & Pulumi
  • Kubernetes

Ui

  • UI & Theming

I18n

  • Internationalization

Content Management

  • Content Management

Admin

  • Admin Panel

Security

  • Security

Monitoring

  • Analytics & Monitoring

Modules

  • Module Architecture
  • Waitlist
  • Audit Log
  • White-Labeling
  • Workflow Automation
  • A/B Testing
  • Welcome Page
  • Referrals
  • GDPR Export and Deletion
  • Outgoing Webhooks

Plugins

  • Plugin System
  • AI Kit Plugin
  • CRM Plugin
  • Helpdesk Plugin
  • Email Marketing Plugin

Deployment

  • Deployment
  • Troubleshooting

Upgrading

  • Upgrading Codapult

Developer Tools

  • AI Agents & IDEs
  • MCP Server
  • Testing
Ai

RAG and Semantic Search

Index documents, generate embeddings, store vectors, and retrieve context for AI responses.

Codapult ships with a retrieval-augmented generation pipeline that can index product knowledge and inject relevant context into AI chat responses. It is implemented as plain TypeScript modules, so you can reuse it for search pages, copilots, helpdesk suggestions, or admin tooling.

Architecture

FilePurpose
src/lib/ai/chunker.tsSplits long text into overlapping chunks
src/lib/ai/embeddings.tsEmbedding provider adapter
src/lib/ai/vector-store.tsVector store adapter
src/lib/ai/rag.tsIndex, search, delete, and prompt helpers
src/app/api/ai/index/route.tsAdmin indexing/search endpoint
src/app/api/ai/search/route.tsSemantic search endpoint

Indexing content

Use indexDocument when your app creates or updates searchable content:

import { indexDocument } from '@/lib/ai/rag';

await indexDocument({
  sourceType: 'help',
  sourceId: 'getting-started',
  title: 'Getting Started',
  content: markdownContent,
});

For larger batches, enqueue the rag-index background job so indexing does not block the user request.

Source types

TypeTypical source
blogBlog posts
helpHelp center articles
feature_requestFeature request descriptions
customProduct-specific content

Embedding providers

Embeddings use an adapter selected by EMBEDDING_PROVIDER.

ProviderEnv valueNotes
OpenAIopenaiDefault; requires OPENAI_API_KEY
OllamaollamaSelf-hosted embeddings via OLLAMA_BASE_URL

Vector stores

Vector storage is selected by VECTOR_STORE_PROVIDER.

StoreEnv valueNotes
SQLitesqlitePersists vectors in the app database
MemorymemoryUseful for tests and local experiments

Search endpoint

/api/ai/search can power semantic search UI. Use it when you want search results without generating an AI response. Use the RAG helpers directly when you need to inject matching chunks into a prompt.

Removal

The RAG pipeline can be removed separately from the basic chat UI. Remove src/lib/ai/rag.ts, src/lib/ai/embeddings.ts, src/lib/ai/vector-store.ts, the AI indexing routes, the embedding table, and the related environment variables.

Streaming ChatQuotas and Memory