Routes with policies
Five routes per resource, each with the policy you wrote: public, authenticated, owner, admin, or a mix like owner | admin. calm routes lists them with the file they came from.
CalmAPI is the Node.js and MongoDB framework we start our APIs from, built in the open by Broadifi Technologies. Instead of hiding in node_modules, it copies its source into your project. You declare what a resource is and who may touch it, and the routes, validation and docs follow.
Version 2 is in beta. If you are on 1.x, its documentation stays online at docs.calmapi.dev/v1.

Most frameworks live in node_modules, and you meet their internals for the first time when something breaks late at night. CalmAPI goes the other way. npm create calmapi puts the framework in a calm/ folder in your repository: commented JavaScript you can read, step through in a debugger and change.
Owning the code usually means giving up upgrades. CalmAPI keeps a calm.lock file with a hash of every framework file, so calm upgrade replaces the files you never touched and three-way merges the ones you did. Conflicts get ordinary conflict markers, like any other merge.
Fields and access rules live in one file. CalmAPI turns them into the Mongoose schema and everything around it. Business logic goes in a service, custom endpoints in a routes file, and both are optional.
Five routes per resource, each with the policy you wrote: public, authenticated, owner, admin, or a mix like owner | admin. calm routes lists them with the file they came from.
Unknown, read-only and hidden fields are rejected with a 422. Query operators are allowlisted, so x[$ne]=1 is a 400, and page size is capped.
A field marked visibleTo('owner | admin') never reaches anyone else, and owner-scoped lists only return the caller's own records.
The OpenAPI 3.1 document is generated from the resource itself, so the docs cannot drift from the code. calm client turns it into a typed client for your web or mobile app.
Opaque sessions stored as SHA-256 hashes, scrypt passwords, lockout after 5 failed logins in 15 minutes, and two-factor login through the totp block.
Blocks like oauth, payments-stripe, jobs, webhooks and push-fcm are copied into app/blocks/ with notes for AI agents next to the code. Most need no extra dependencies.
Run npm run dev and open /_calm. There is no extra service and no browser extension. Devtools only run in development and only answer on localhost, and they cannot be switched on in production.



We use AI agents on real code, so CalmAPI is designed for them. An agent connects through calm mcp and gets 29 tools for the project: scaffold a resource, call the API as any user, run the tests, run the audit. New projects ship with AGENTS.md and CLAUDE.md, so the agent knows the conventions before it writes a line.
Everything the agent does lands in one activity log that devtools streams live, with diffs and the requests it sent. calm review shows what changed since a person last signed off, and calm review --sign refuses to run in an agent's shell. That is how we work anyway: AI writes the draft, a named engineer signs it.
You need Node.js 22.12 or newer and a MongoDB to talk to.
Pick the api template for sign-up, users and posts, or minimal for an empty app.
npm create calmapi@latest my-api
The API answers on localhost:5001/api and devtools on localhost:5001/_calm.
cd my-api && npm run dev
Tests, then the authorization audit. Both run against a throwaway database.
npm test && npx calm audit
It is in beta. The framework has 443 tests that run against a real MongoDB, but details can still change before 2.0 is final. On a 1.x project, run npx calmapi@next doctor first and follow the migration guide.
No. CalmAPI is built on Express 5 and Mongoose, so it needs MongoDB.
No. The agent tools are there if you want them. Resources, the audit and devtools work the same without one.
Yes. It is MIT licensed, and the framework code in your repository is yours.
When it fits. It is our default for Node.js APIs on MongoDB. If your project needs something else, we use something else.