Codapult
PreisePluginsBlogDokuDemo

Das SaaS-Boilerplate für Macher

© 2026 Codapult. Alle Rechte vorbehalten.

Built with Codapult

Projekt

  • Preise
  • Plugins
  • Dokumentation
  • SaaS-Template-Vergleich

Über uns

  • Kontakt

Rechtliches

  • Datenschutzrichtlinie
  • Nutzungsbedingungen
Alle Artikel

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

Quotas and Memory

Persist AI conversations and control monthly 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
chat_conversationConversation metadata: owner, title, timestamps
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/chat/conversationsGETList conversations
/api/chat/conversationsPOSTCreate a conversation
/api/chat/conversations/[id]/messagesGETRead messages
/api/chat/conversations/[id]/messagesPOSTSave messages

Quotas

AI chat requests are checked against the aiChat usage resource before the model call. The default monthly allowance comes from DEFAULT_MONTHLY_CREDITS and plan configuration.

When a request is allowed, usage is recorded through the same usage-credit system used elsewhere in the template. This keeps AI controls aligned with SaaS billing and organization limits instead of living as a separate one-off counter.

Rate limiting

POST /api/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 monthly AI credits per plan.
  • Add per-organization override controls in the admin panel.
  • Track token cost by provider if you add a custom cost analytics layer.
  • Disable conversation persistence for privacy-sensitive products.

Related docs

  • Payments & Billing
  • Streaming Chat
  • RAG and Semantic Search
RAG and Semantic SearchEmail