AI Decision System
Replayable, offline-verifiable records for AI-assisted go/no-go decisions: experiment promotions, typed model answers and human-approved actions.
Self-hosted backend on Cloudflare Workers and D1: policies compiled to SQL, Better Auth, auto REST and a read-only MCP server.
Translation pending
Developer toolsTypeScript · JavaScriptGitHub @ozerozdasOnlineOwner unconfirmed
Have you tried it? One tap is enough. No sign-in needed.
Owners of public repositories under a personal GitHub account can sign in to verify ownership and manage the introduction themselves. No administrator approval is needed.
Sign in, generate a verification file, and commit it to this repository’s default branch within 30 minutes. Files on other branches or forks do not count. Then check the file below to manage the project without administrator approval. Keep the file to retain your access.
If needed, you will go to sign-in. After signing in, return here and press your chosen verification button again.
Run /nomorevibe verify in your project folder to verify ownership and manage the introduction yourself.
Verify in one minuteAsk about other verification options
Self-hosted, agent-safe backend on Cloudflare Workers + D1: policies compiled to SQL, Better Auth, auto REST and a read-only MCP server.
Taken from the repository README
Loading the full README.
Read the full README ↗A self-hosted backend on Cloudflare: one Worker and one D1 database in your account serve REST endpoints for your tables. Every endpoint is protected by policies written in TypeScript and compiled to SQL. An MCP server lets AI agents inspect exactly what production enforces.
WHERE clauses, so pagination and counts stay correct.Status: v0.4.1 (changelog). Early, but deployed and working. Upgrading from 0.4.0? See the upgrade guide. Read Status and limits before using it for anything important.
Requires Node 20+ and pnpm.
npm create @castra-kit@latest my-app
cd my-app
cp .dev.vars.example .dev.vars # set BETTER_AUTH_SECRET: openssl rand -base64 32
pnpm db:migrate:local
pnpm dev # http://localhost:8787/health
Deploy to your Cloudflare account (token permissions: docs/cloudflare-token.md):
CLOUDFLARE_API_TOKEN=... pnpm run deploy
The full walkthrough, including your first request and your first policy, is in Getting started.
import { authenticated, defineConfig, isPublic, owner, role } from "@castra-kit/core";
export default defineConfig({
database: "d1",
roles: ["admin", "editor"],
tables: {
posts: {
read: isPublic().where((q) => q.eb("status", "=", "published")).or(owner("author_id")),
create: authenticated(),
update: owner("author_id").or(role("editor", "admin")),
delete: role("admin"),
fields: { author_id: { setBy: "server" } },
},
},
});
// Any table not listed here is never exposed.
| Getting started | Scaffold, run, first request, first policy, deploy |
| Concepts and configuration | Rules, write checks, field rules, config reference |
| REST API | Routes, filters, sorting, pagination, includes, errors |
| Auth | Better Auth, sessions, roles, API keys |
| MCP | Tools, local stdio server, remote /mcp, tokens and scopes |
| CLI | castra generate, provision, migrate, deploy, doctor, mcp |
| Rate limiting | Per-IP write limits, WAF rule for reads |
| Status and limits | What is verified, D1 limits, what is out of scope |
| Security | Threat model, guarantees, known issues |
| Problem types | Every error code the API returns |
| Architecture · |
Questions and ideas: Discussions. Troubleshooting and FAQ: Wiki.
| Package | |
|---|---|
@castra-kit/core | Policy engine, schema snapshot, REST router, OpenAPI |
@castra-kit/auth | Better Auth wiring, roles, API keys |
@castra-kit/mcp | MCP tools, stdio server, /mcp route |
@castra-kit/app | createCastraApp: the Worker wiring in one call |
@castra-kit/cli | The castra command |
@castra-kit/create | Project scaffolder |
See CONTRIBUTING.md. Report vulnerabilities privately, as described in SECURITY.md.
MIT © Mehmet Özer Özdaş
| Design and one record per decision |