Codapult
DocsBlogPricingPluginsDemo
Get Codapult
Logo

Build your SaaS with AI. Keep the architecture under control.

Get Codapult

Product

  • Pricing
  • Architecture
  • Modules
  • AI platform
  • Plugins

Developers

  • MCP
  • CLI
  • Documentation
  • Launch your SaaS
  • Build a B2B SaaS

Resources

  • Blog
  • FAQ

Connect

  • Contact
  • GitHub

Compare

  • SaaS template comparison
  • Codapult vs Supastarter
  • Codapult vs Makerkit
  • Codapult vs ShipFast
  • Codapult vs SaaSBold
  • Codapult vs Gravity
  • Codapult vs Nextbase
  • Codapult vs BuilderKit

Featured on

Codapult on LaunchNestCodapult on LaunchNestbetterlaunch.cobetterlaunch.coFeatured on LaunchBuffFeatured on LaunchBuffCodapult on PeerPushCodapult on PeerPushFeatured on LaunchItFeatured on LaunchIt
© 2026 Codapult·All rights reserved·Privacy Policy·Terms of Service
Full source code · One-time purchase · Self-host anywhere
All articles

Getting Started

  • Introduction
  • Quick Start
  • Your First 30 Minutes
  • Project Structure
  • License and Permitted Use
  • Starter Profiles and Recipes
  • Product Recipes

Configuration

  • Environment Variables
  • App Configuration
  • Which Modules Should I Enable?
  • Provider Matrix
  • Capability Coverage

Database

  • Database and Provider Guide
  • Database
  • Migrations

Authentication

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

Ai

  • AI Runtime Architecture and Evals
  • AI Features
  • Streaming Chat
  • RAG and Semantic Search
  • Quotas and Memory

Teams

  • Teams & Organizations
  • Permissions & RBAC
  • SCIM Provisioning

Security

  • Data Retention Policy
  • Security

Deployment

  • Enterprise E2E Evidence
  • Enterprise Production Readiness
  • Deployment, Backup, and Restore Runbook
  • Deployment
  • Troubleshooting

Payments

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

Api

  • API Layer
  • tRPC
  • GraphQL

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

Monitoring

  • Analytics & Monitoring

Modules

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

Plugins

  • Plugin System
  • CRM Plugin
  • Helpdesk Plugin
  • Email Marketing Plugin

Upgrading

  • Upgrading Codapult

Developer Tools

  • AI Agents & IDEs
  • MCP Server
  • Testing
  • Build Your First Feature with Codapult MCP
  • How Guard Blocks an Architectural Regression
Ai

Quotas and Memory

Persist AI conversations and control AI usage per organization.

Codapult's AI layer includes two production controls that most demos skip: persistent chat history and usage limits. They are designed for SaaS products where AI usage has real infrastructure cost.

Conversation memory

Conversation history is stored in two tables:

TablePurpose
ai_chat_conversationConversation metadata: owner, title, timestamps
ai_chat_messageIndividual messages with role and content

The helper module is src/lib/ai/conversations.ts. It exposes list, create, update-title, delete, read messages, and save message helpers.

API routes

RouteMethodPurpose
/api/ai/chat/conversationsGETList conversations
/api/ai/chat/conversationsPOSTCreate a conversation
/api/ai/chat/conversationsDELETEDelete a conversation
/api/ai/chat/conversations/[id]/messagesGETRead messages

Quotas

AI requests are checked against the organization aiChat quota before model work starts. The default limits and their time windows are defined in src/lib/org-quotas.ts; the same access check is used by the chat, gateway, and batch API entry points. This request quota is separate from token-cost analytics and the optional daily or monthly spend budgets in the AI gateway.

When a request is allowed, token usage, provider cost, latency, and request status are recorded by the AI metering layer. This keeps cost analytics and budget checks on the same gateway path instead of hiding them inside a one-off chat counter.

Rate limiting

POST /api/ai/chat also applies a per-user request rate limit before the provider call. This protects you from accidental loops, scripted abuse, and runaway UI retries.

Product customization

Common changes:

  • Increase or reduce the aiChat request quota per plan.
  • Add per-organization override controls in the admin panel.
  • Configure daily or monthly AI spend budgets when cost ceilings are required.
  • Disable conversation persistence for privacy-sensitive products.

Related docs

  • Payments & Billing
  • Streaming Chat
  • RAG and Semantic Search
RAG and Semantic SearchTeams & Organizations