codehooks-backend
Develop, deploy, and manage Codehooks.io serverless backends — REST APIs, webhooks, NoSQL database, scheduled jobs, queue workers, and workflows.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Develop, deploy, and manage Codehooks.io serverless backends — REST APIs, webhooks, NoSQL database, scheduled jobs, queue workers, and workflows.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| name | codehooks-backend |
| description | Develop, deploy, and manage Codehooks.io serverless backends — REST APIs, webhooks, NoSQL database, scheduled jobs, queue workers, and workflows. |
| detection | Look for a config.json file in the project root containing "name" and "space" fields — this indicates a Codehooks project. |
You are working in a Codehooks.io serverless backend project. Codehooks lets you write JavaScript/TypeScript code and deploy it to a live serverless backend in ~5 seconds.
If the project is already set up (config.json exists with name and space), skip to Core Workflow.
# Install the CLI
npm install -g codehooks
# Login to Codehooks
coho login
# Create a new project
coho create <project-name>
# Generate an admin token for CI/CD and agent use
coho add-admintoken
Before writing any code, run:
coho prompt
This outputs the complete codehooks-js API reference — routing, database operations, queues, jobs, workflows, and all available methods. Read the full output to understand the API before generating code.
Before modifying an existing project, get the full picture:
# Run doctor FIRST — returns JSON with collections, stats, recent deploys, and error logs
# This is the single best command for understanding a project's current state
coho doctor
# Describe the app structure — collections, schemas, queues, files
coho describe
# Get endpoint URLs with cURL examples
coho info --examples
coho doctor is the most powerful diagnostic command. It returns structured JSON covering database collections with document counts, deployment history, queue and worker status, and recent error logs. Always run it when joining an existing project or debugging issues.
# Deploy code (~5 seconds to live)
coho deploy
# Stream real-time logs
coho log -f
# Query a database collection
coho query -c <collection> -q 'field=value'
# Check queue status
coho queue-status
# Check workflow status
coho workflow-status
# Import data from JSON file
coho import -c <collection> --file data.json
# Export data from a collection
coho export -c <collection>
All codehooks-js code follows this structure:
import { app, Datastore } from 'codehooks-js';
// Register handlers (routes, jobs, workers, workflows)
app.get('/hello', (req, res) => {
res.json({ message: 'Hello, world!' });
});
// MANDATORY: bind to serverless runtime
export default app.init();
Key patterns:
app.get(), app.post(), app.put(), app.patch(), app.delete()const conn = await Datastore.open() then conn.insertOne(), conn.getMany(), conn.updateOne(), etc..toArray() when you need to manipulate data (sort, filter, map)req.rawBody for signature verification (not req.body). Bypass auth with app.auth('/webhook/*', (req, res, next) => next())app.job('0 9 * * *', async (_, { jobId }) => { ... })app.worker('queueName', async (req, res) => { ... }) and enqueue with conn.enqueue('queueName', payload)app.createWorkflow('name', 'description', steps, config)app.crudlify({ collection: schema }) for instant REST APIs with validationapp.static({ route: '/app', directory: '/public' }) to serve static sites from deployed sourceapp.storage({ route: '/docs', directory: '/uploads' }) to serve uploaded filesapp.auth('/public/*', (req, res, next) => next()) for public endpointsprocess.env.VARIABLE_NAME for secrets and API keys.ts filesDo NOT use: fs, path, os, or any modules requiring file system access.
Ready-to-use templates are available in the examples/ directory of this plugin:
examples/webhook-handler.js — Stripe webhook with signature verificationexamples/daily-job.js — Cron-scheduled background jobexamples/queue-worker.js — Async queue processing with task enqueueexamples/workflow-automation.js — Multi-step autonomous workflow with retries and statecoho prompt and read the full API referencecoho describe to understand what's already deployedcoho deploy (5 seconds to live)coho log -f or test endpoints with coho info --examples