Blog with Comments
Posts with slugs, cover images, and threaded comments. Public reading, only authors can edit their own content.
Spin up this backend in one click.
We create the project, apply the schema, and drop you in the dashboard. If you’re not signed in yet, you’ll sign up first — the template applies the moment you land. Free.
Sign up takes ~30 seconds. We pay for the project creation; usage falls under your plan’s free tier.
What you get
- Posts and comments are public-read; only authors can edit/delete their own
- Comments cascade-delete when their parent post is deleted
- Cover images and avatars via the built-in
filetype - Slug uniqueness enforced at the schema level
Schema
Copy and apply with PUT /v1/schema or set_schema via MCP. MoonDB auto-creates 3 tables: users, posts, comments.
{
"tables": {
"users": {
"auth_table": true,
"columns": {
"display_name": "string required max_length 80",
"avatar": "file"
}
},
"posts": {
"columns": {
"title": "string required max_length 200",
"slug": "string required unique",
"body": "text required",
"cover_image": "file",
"published": "bool default false",
"user_id": "ref users required"
},
"owner_field": "user_id",
"access": {
"read": "public",
"create": "authenticated",
"update": "owner",
"delete": "owner"
}
},
"comments": {
"columns": {
"post_id": "ref posts required cascade",
"body": "text required max_length 2000",
"user_id": "ref users required"
},
"owner_field": "user_id",
"access": {
"read": "public",
"create": "authenticated",
"update": "owner",
"delete": "owner"
}
}
}
}
Auto-generated endpoints
The moment the schema applies, this REST surface is live (replace {project_id} with the id returned by POST /v1/projects):
GET /api/users list/filter/sort/paginate
GET /api/users/{id} read one
POST /api/users create
PATCH /api/users/{id} partial update
DELETE /api/users/{id} delete
POST /api/users/bulk atomic bulk insert
POST /auth/signup (from this auth_table)
POST /auth/login (from this auth_table)
GET /auth/me Bearer {token}
GET /api/posts list/filter/sort/paginate
GET /api/posts/{id} read one
POST /api/posts create
PATCH /api/posts/{id} partial update
DELETE /api/posts/{id} delete
POST /api/posts/bulk atomic bulk insert
GET /api/comments list/filter/sort/paginate
GET /api/comments/{id} read one
POST /api/comments create
PATCH /api/comments/{id} partial update
DELETE /api/comments/{id} delete
POST /api/comments/bulk atomic bulk insert
Plus auto-generated /v1/openapi.json (OpenAPI 3.0.3) and /v1/llm-context (machine-readable agent reference) for any client generator or coding agent.
Prefer to wire it up by hand instead of the one-click button up top? The options below apply the same schema manually — pick whichever fits your workflow.
Apply via REST
# 1. create the project
curl -X POST https://api.moondb.ai/v1/projects \
-H "X-API-Key: mk_..." \
-H "Content-Type: application/json" \
-d '{"name":"blog"}'
# 2. apply the template schema
curl -X PUT https://api.moondb.ai/p/{project_id}/v1/schema \
-H "X-Admin-Key: sk_..." \
-H "Content-Type: application/json" \
-d @blog.schema.json
Apply via MCP
If your agent has the MoonDB MCP server installed (see install), one tool call applies the template:
# call set_schema via MCP (Cursor, Claude Code, Windsurf)
{ "jsonrpc": "2.0", "id": 1, "method": "tools/call",
"params": { "name": "set_schema", "arguments": {
"project_id": "...",
"schema": {
"tables": {
"users": {
"auth_table": true,
"columns": {
"display_name": "string required max_length 80",
"avatar": "file"
}
},
"posts": {
"columns": {
"title": "string required max_length 200",
"slug": "string required unique",
"body": "text required",
"cover_image": "file",
"published": "bool default false",
"user_id": "ref users required"
},
"owner_field": "user_id",
"access": {
"read": "public",
"create": "authenticated",
"update": "owner",
"delete": "owner"
}
},
"comments": {
"columns": {
"post_id": "ref posts required cascade",
"body": "text required max_length 2000",
"user_id": "ref users required"
},
"owner_field": "user_id",
"access": {
"read": "public",
"create": "authenticated",
"update": "owner",
"delete": "owner"
}
}
}
}
} } }
Prompt your agent
Or just paste this one-liner into Cursor / Claude Code / Lovable after the MoonDB prompt is in .cursorrules / CLAUDE.md:
Apply the MoonDB "Blog" template — users (auth_table) with avatar, posts (public read), comments (cascade on post delete), all owner-scoped writes.
Extending the template
Send the full updated schema (with your additions) to PUT /v1/schema — MoonDB diffs against the current version and auto-migrates. Destructive changes (dropping columns, narrowing enums, renaming) require "confirm_destructive": true in the body. Read more about schema updates →
Ship this in 30 seconds
Sign up free, create a project, paste the schema. The API is live before your kettle boils.
Get an API keyRelated templates
Todo App
Personal tasks with priorities (low/medium/high), due dates, done toggle. Each user sees only their own todos.
Habit Tracker
Users create habits with frequency and color, log daily completions (one per day enforced), track streaks.
Bookmarks Manager
Save URLs with title, description, and tags. Private per-user collection — simplest starter template.