AI Decision System
Replayable, offline-verifiable records for AI-assisted go/no-go decisions: experiment promotions, typed model answers and human-approved actions.
翻译准备中
个人 GitHub 账号下公开仓库的所有者可以登录并验证所有权,自行管理介绍,无需管理员批准。
登录并生成验证文件,在 30 分钟内将其提交到此仓库的默认分支。其他分支或分叉仓库中的文件无效。然后在下方检查文件,即可无需管理员批准直接管理项目。请保留文件以维持管理权限。
如需登录,将前往登录页面。登录后请回到此处,再次点击所选的验证按钮。
在项目文件夹中运行 /nomorevibe verify,即可验证所有权并自行管理介绍。
一分钟完成验证Self-hosted, agent-safe backend on Cloudflare Workers + D1: policies compiled to SQL, Better Auth, auto REST and a read-only MCP server.
翻译准备中
取自仓库 README
正在加载完整 README。
查看完整 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 |