Codapult
PricingPluginsDocs
Codapult

The SaaS Boilerplate for Builders

Product

  • Pricing
  • Plugins
  • Documentation

Company

  • Contact
  • GitHub

Legal

  • Privacy Policy
  • Terms of Service

© 2026 Codapult. All rights reserved.

All articles

Getting Started

  • Introduction
  • Quick Start
  • Project Structure

Configuration

  • Environment Variables
  • App Configuration

Authentication

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

Database

  • Database
  • Migrations

Teams

  • Teams & Organizations
  • Permissions & RBAC

Payments

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

Api

  • API Layer
  • tRPC
  • GraphQL

Ai

  • AI Features

Email

  • Email
  • Email Templates

Infrastructure

  • Infrastructure
  • File Storage
  • Background Jobs

Ui

  • UI & Theming

I18n

  • Internationalization

Content Management

  • Content Management

Admin

  • Admin Panel

Security

  • Security

Monitoring

  • Analytics & Monitoring

Modules

  • Module Architecture

Plugins

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

Deployment

  • Deployment
  • Troubleshooting

Upgrading

  • Upgrading Codapult

Developer Tools

  • MCP Server
  • Testing
Infrastructure

Background Jobs

Offload work to background jobs with in-memory or BullMQ (Redis) adapters.

Offload work to background jobs for email sending, webhook delivery, credit resets, and RAG indexing. The job adapter is selected by JOB_PROVIDER.

Providers

ProviderEnv ValueBest For
In-memory queuememory (default)Development, single-instance
BullMQ (Redis)bullmqProduction, multi-instance

Enqueuing Jobs

import { enqueue, enqueueEmail } from '@/lib/jobs';

// Generic job
await enqueue('webhook-retry', { webhookId: 'wh_123', attempt: 1 });

// Shorthand for emails
await enqueueEmail('[email protected]', 'Welcome!', emailHtml);

Built-in Jobs

Job NameDescription
send-emailSends transactional email via Resend
webhook-retryRetries failed webhook deliveries with exponential backoff
credit-resetResets monthly AI/usage credits for all organizations
rag-indexIndexes documents for AI RAG pipeline

Cron Jobs

ScheduleTask
DailySession cleanup (remove expired sessions)
MonthlyCredit reset (reset usage quotas)

Cron jobs run automatically when the app starts. They use the same job adapter.

Switching to BullMQ

For production, use BullMQ with Redis for durable, concurrent job processing:

JOB_PROVIDER="bullmq"
REDIS_URL="redis://localhost:6379"
JOB_QUEUE_NAME="my-app"   # optional, defaults to "codapult"

Worker Process

In production, run the worker as a separate process alongside your Next.js server. The worker picks up jobs from Redis and processes them independently.

For Kubernetes deployments, the Helm chart includes a dedicated worker Deployment. For Docker, add a separate service in docker-compose.yml.

Important: The memory adapter processes jobs in-process and loses pending jobs on restart. Always use bullmq in production.

Environment Variables

VariableRequiredDescription
JOB_PROVIDERNo"memory" (default) or "bullmq"
REDIS_URLYes*Redis connection URL, e.g. redis://localhost:6379
JOB_QUEUE_NAMENoBullMQ queue name. Defaults to "codapult"

* Required when JOB_PROVIDER=bullmq.

File StorageUI & Theming