docs

Blocks

Blocks are production features you add with one command. Like shadcn/ui components, they are copied into your project as source code: you read them, own them and change them. There is no runtime package to keep up with.

Terminal
npx calm add jobs
Text
  Blocks
  + @calmapi/jobs v1.0.0 · @calmapi (bundled)
    Background jobs and cron on MongoDB (no Redis): retries with backoff, schedules, event triggers, admin API and a devtools panel.

  Files
  create    app/blocks/jobs/cron.js
  create    app/blocks/jobs/index.js
  create    app/blocks/jobs/queue.js
  create    app/jobs/welcome-email.js

  Environment (.env.example and .env)
  + JOBS_WORKER=on
  + JOBS_CONCURRENCY=4

? Apply these changes? [Y/n]

calm add writes the files, adds npm dependencies to package.json and installs them, appends environment variables to .env.example and .env (without touching values you already have), records the block in calm.lock, and prints the block's notes. Restart (or let npm run dev restart) and the block is live: every folder in app/blocks/ with an index.js is loaded at boot.

Official blocks#

There are 35, each with its own page here and its own guide in the project after you add it (below).

35 official blocks

Users and access8

  • api-keysv1.0.0

    API keys

    Personal and service API keys with scopes for scripts and integrations: shown once, hashed at rest, expiry and revoke.

    no deps4 files

  • captchav1.0.0

    CAPTCHA

    Cloudflare Turnstile, hCaptcha or reCAPTCHA v3 on sign-up, sign-in and password reset, failing closed.

    no deps2 files2 env vars

  • email-verificationv1.0.0

    Email verification

    Verification links after sign-up and email changes, a verified policy, and required verification for routes or sign-in.

    no deps2 files

  • magic-linkv1.0.0

    Magic link sign-in

    Passwordless sign-in by email: single use links, a cooldown per address, a redirect allowlist and links bound to the browser that asked.

    no deps2 files

  • oauthv1.0.0

    Sign in with Google, GitHub and OpenID Connect

    OAuth and OpenID Connect sign-in with PKCE, verified ID tokens and safe account linking.

    no deps4 files4 env vars

  • privacyv1.0.0

    Privacy: export and delete

    Users download everything they own and delete their account; per resource delete, anonymize or keep, with admin routes and a grace period.

    no deps4 files

  • teamsv1.0.0

    Teams and organizations

    Organizations, roles, invitations and team-scoped resources with strict isolation.

    no deps5 files

  • totpv1.0.1

    Two-factor authentication

    Authenticator-app codes on login, with single-use recovery codes, replay protection and secrets encrypted at rest.

    no deps3 files1 env var

Messaging10

  • mail-postmarkv1.0.0

    Email via Postmark

    Deliver email through Postmark with tags, message streams and attachments.

    no deps2 files3 env vars

  • mail-resendv1.0.1

    Email via Resend

    Deliver password resets and notifications through the Resend HTTP API.

    no deps2 files2 env vars

  • mail-smtpv1.0.1

    Email via SMTP

    Deliver email through any SMTP server with Nodemailer.

    nodemailer2 files2 env vars

  • notificationsv1.0.0

    Notifications: inbox, push and email

    One call writes the in-app inbox, sends a push and an email, following each user's preferences and quiet hours.

    no deps5 files

  • push-expov1.0.0

    Push notifications via Expo

    Deliver push notifications to Expo and React Native apps through the Expo push service.

    no deps2 files1 env var

  • push-fcmv1.0.0

    Push notifications via Firebase Cloud Messaging

    Deliver push notifications to Android, iOS and web through Firebase Cloud Messaging HTTP v1, no SDK.

    no deps2 files1 env var

  • realtime-ssev1.1.0

    Realtime (SSE)

    Live resource events over Server-Sent Events, filtered per subscriber by your policies.

    no deps2 files

  • slackv1.0.0

    Slack alerts

    App events and security alerts to Slack, with escaped templates, digests and retries.

    no deps2 files3 env vars

  • sms-twiliov1.0.0

    SMS and phone verification with Twilio

    An SMS transport and phone verification with hashed one-time codes and signed status callbacks.

    no deps3 files4 env vars

  • webhooksv1.0.1

    Webhooks

    Outgoing webhooks for resource events: signed, queued, retried and logged, filtered by what each subscriber may read, SSRF safe.

    no deps5 files1 env var

Data and files6

  • audit-logv1.0.1

    Audit log

    Who changed what and when, with field-level diffs that never record private values.

    no deps2 files1 env var

  • exportv1.0.0

    Export and import

    Streamed CSV, NDJSON or JSON exports that respect field visibility, and validated imports with dry runs.

    no deps3 files

  • search-meilisearchv1.0.0

    Search with Meilisearch

    Full-text search kept in sync with your resources, filtered by your policies.

    no deps3 files3 env vars

  • soft-deletev1.0.0

    Soft delete

    Opt-in soft delete per resource, with trash and restore for admins.

    no deps2 files

  • storage-localv1.0.1

    Local file storage

    File uploads to local disk with type and size allowlists, magic-byte checks and safe downloads.

    multer6 files3 env vars

  • storage-s3v1.0.1

    S3 file storage

    Direct-to-S3 uploads with presigned URLs for AWS S3, Cloudflare R2 and MinIO.

    @aws-sdk/client-s3, @aws-sdk/s3-request-presigner6 files7 env vars

Running in production7

  • cachev1.0.0

    Response cache

    GET responses cached per identity in MongoDB or memory, invalidated by resource events, with ETag and 304.

    no deps3 files

  • feature-flagsv1.0.0

    Feature flags

    Kill switches, gradual rollouts, per user and per role targeting, weighted variants and route gates, stored in MongoDB.

    no deps4 files

  • idempotencyv1.0.0

    Idempotency keys

    Safe retries for writes: the Idempotency-Key header replays the stored response instead of running an operation twice.

    no deps2 files

  • jobsv1.0.1

    Background jobs

    A MongoDB job queue and cron: retries, schedules, event triggers and an admin API. No Redis.

    no deps5 files2 env vars

  • maintenancev1.0.0

    Maintenance mode

    Maintenance and read-only modes at runtime or on a schedule, with allowlists and Retry-After.

    no deps2 files1 env var

  • rate-limit-mongov1.0.0

    Shared rate limits

    Keep rate limit counters in MongoDB so limits hold across instances.

    no deps2 files

  • sentryv1.0.0

    Error reporting with Sentry

    5xx and background errors to Sentry without the SDK, with secrets scrubbed, sampling and deduplication.

    no deps3 files3 env vars

Payments and growth2

  • payments-stripev1.0.0

    Payments with Stripe

    Stripe Checkout, subscriptions and the customer portal without the SDK, verified webhooks and plan-gated routes.

    no deps4 files2 env vars

  • waitlistv1.0.0

    Waitlist

    A launch waitlist with referral codes, admin invites and invite-only registration.

    no deps2 files

APIs and agents2

  • api-docsv1.0.1

    API docs

    An interactive API reference at /docs, rendered from your OpenAPI document.

    no deps2 files1 env var

  • mcp-serverv1.0.1

    MCP server

    Expose your resources to AI agents as MCP tools, enforced by your API rules.

    no deps2 files1 env var

Terminal
npx calm add --list                 # official blocks
npx calm add jobs audit-log         # several at once
npx calm add jobs --dry-run         # show the plan, write nothing
npx calm block list                 # blocks in this project, and the files you changed

The devtools Blocks panel shows every installed block: where it came from, the files you changed since, what it hooks into, its environment variables (set or missing), its routes, links to the official documentation of what it integrates, and its instructions for AI agents.

Each block brings its own guide#

Every block is added with an app/blocks/<name>/AGENTS.md next to its code: the rules it must keep, its options, common tasks, and links to the official documentation of the service it integrates (Stripe, Twilio, Slack, OpenID Connect, OWASP...). The project's AGENTS.md tells coding agents to read it before they change the block, so they follow the provider's documentation rather than memory. It comes from the links and agents fields of the block's block.json; see Agents and links.

Where blocks come from#

An address is resolved like this:

AddressSource
jobs or @calmapi/jobsThe official registry. The CLI carries a copy of it, so this works offline. --remote fetches https://docs.calmapi.dev/r/jobs.json instead.
gh:acme/blocks/billingr/billing.json in a GitHub repository, what calm block pack writes. Add @v1.2.0 (or a branch or commit) to pin it.
@acme/billingThe @acme registry declared in your package.json
https://example.com/r/thing.jsonAny URL
./blocks/thing.jsonA local file

Registries are declared in package.json:

JSON
{
  "calm": {
    "registries": { "@acme": "https://acme.dev/r/{name}.json" }
  }
}

The official registry is served as JSON at https://docs.calmapi.dev/r/index.json, one file per block (for example /r/jobs.json), in the shadcn registry-item format. To write and share your own, see Building your own block and Publishing your own block.

Safety rules#

  • A block can only write inside your project, never to calm/ or calm.lock.
  • Existing files with different content are kept and reported as conflicts; pass --overwrite to replace them.
  • Blocks that provide the same resource refuse to be installed together (storage-local and storage-s3 both provide file).
  • registryDependencies are installed first; dependencies already in package.json are left as they are.
  • Blocks can declare the oldest CalmAPI they work with (minVersion); older projects are asked to run calm upgrade first.
  • Blocks that are not official are reviewed before anything is written: calm add lists in plain language what their code does (network requests, file writes, child processes, eval, request hooks, the environment variables it reads, the hosts it mentions). Risky findings must be confirmed, and with --yes they also need --trust. A block runs in your app with full access, like any code you paste, so read it. See What people see before installing.

After adding a block#

The block's code is now in your project, and it is yours. Change it, delete parts you do not need, or remove the block by deleting its folder (and its entry in calm.lock). Re-running calm add <block> later shows which files differ from the current upstream version. calm upgrade never touches block files.

Last updated