Convex Adapter
The Convex adapter stores your content schema in a Convex database, providing real-time sync and reactive updates. This adapter powers the ACMS SaaS platform.
Installation
Section titled “Installation”npm install @useacms/cliConfiguration
Section titled “Configuration”import { defineConfig } from '@useacms/client';import { localFile, convex } from '@useacms/cli/adapters';
export default defineConfig({ dev: localFile({ path: './acms.json' }), production: convex({ deploymentUrl: process.env.CONVEX_URL, projectId: process.env.ACMS_PROJECT_ID, }),});Options
Section titled “Options”| Option | Type | Required | Description |
|---|---|---|---|
deploymentUrl | string | Yes | Convex deployment URL |
projectId | string | Yes | ACMS project ID in the Convex database |
1. Set Up a Convex Project
Section titled “1. Set Up a Convex Project”If you’re self-hosting the ACMS backend:
npx convex initnpx convex dev2. Configure Environment Variables
Section titled “2. Configure Environment Variables”CONVEX_URL=https://your-deployment.convex.cloudACMS_PROJECT_ID=your_project_idacms push # Upload to Convexacms pull # Download from Convexacms sync # Bi-directional syncHow It Works
Section titled “How It Works”- Read: Queries the Convex database for the project’s schema.
- Write: Mutates the Convex database with the updated schema.
- Watch: Subscribes to real-time updates via Convex’s reactive system.
Convex provides real-time subscriptions, so changes made in the dashboard or by other users are propagated instantly.
Real-Time Sync
Section titled “Real-Time Sync”Unlike other adapters that require polling or manual sync, the Convex adapter supports real-time subscriptions:
import { acms, subscribe } from '@useacms/client';
// Content updates automatically when changed in the databasesubscribe(() => { console.log('Content updated:', acms.hero.title);});Use Cases
Section titled “Use Cases”- ACMS SaaS platform — The hosted platform uses Convex as its backend.
- Real-time collaboration — Multiple editors see changes instantly.
- Multi-tenant applications — Convex supports per-project isolation.
- Reactive applications — Best for apps that need live content updates.
SaaS Platform
Section titled “SaaS Platform”The Convex adapter is the foundation of the ACMS hosted SaaS platform. When using the SaaS platform, you don’t need to configure Convex directly — the platform handles infrastructure, authentication, and project management.
See Hosted SaaS for more information.
Limitations
Section titled “Limitations”- Requires a Convex account and deployment.
- Self-hosting requires running a Convex backend.
- Database size limits depend on your Convex plan.
Next Steps
Section titled “Next Steps”- Learn about the Hosted SaaS platform
- Explore other adapters: GitHub, Vercel Edge Config