codehooks-js 1.4.1 → 1.4.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +66 -31
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
# codehooks-js
|
|
2
2
|
|
|
3
|
-
The official JavaScript/TypeScript library for [Codehooks.io](https://codehooks.io)
|
|
3
|
+
The official JavaScript/TypeScript library for [Codehooks.io](https://codehooks.io) — the agent-native backend platform. A complete backend — API routes, NoSQL database, key-value store, worker queues, cron jobs, and static asset hosting — in a single import.
|
|
4
4
|
|
|
5
5
|
## Why Codehooks?
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
**Single Cohesive Library** – REST routes, NoSQL database, key-value store, queues, scheduled jobs, file storage, and real-time APIs. One library, one pattern, everything works together.
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
**Zero Infrastructure Assembly** – No AWS/GCP service configuration. No API Gateway + Lambda + DynamoDB + SQS wiring. Write code and deploy — the platform handles everything else.
|
|
10
|
+
|
|
11
|
+
**AI Agent Native** – The entire lifecycle is CLI-native. Any tool that can run shell commands — Claude Code, Cursor, Codex, Cline — can autonomously create, deploy, verify, and iterate on a production backend.
|
|
12
|
+
|
|
13
|
+
**Sub-5-Second Deploys** – Your agent can iterate 50 times in the time it takes other platforms to deploy once.
|
|
14
|
+
|
|
15
|
+
**Flat-Rate Pricing** – Unlimited compute included. No per-request fees, no surprise bills.
|
|
13
16
|
|
|
14
17
|
## Quick Start
|
|
15
18
|
|
|
@@ -27,6 +30,51 @@ cd myproject
|
|
|
27
30
|
npm install codehooks-js
|
|
28
31
|
```
|
|
29
32
|
|
|
33
|
+
## AI Agent Setup
|
|
34
|
+
|
|
35
|
+
### Claude Code Plugin (Recommended)
|
|
36
|
+
|
|
37
|
+
```
|
|
38
|
+
/plugin marketplace add RestDB/codehooks-claude-plugin
|
|
39
|
+
/plugin install codehooks@codehooks
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Then use `/codehooks:backend` to start building.
|
|
43
|
+
|
|
44
|
+
### Built-in AI Prompt
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
coho prompt # Display the Codehooks development prompt
|
|
48
|
+
coho prompt | pbcopy # Copy to clipboard (macOS)
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### MCP Server
|
|
52
|
+
|
|
53
|
+
For tools without terminal access (Claude Desktop, Cline, Zed): [codehooks-mcp-server](https://github.com/RestDB/codehooks-mcp-server). Always prefer the CLI when available.
|
|
54
|
+
|
|
55
|
+
## REST API Example
|
|
56
|
+
|
|
57
|
+
```javascript
|
|
58
|
+
import { app, Datastore } from 'codehooks-js';
|
|
59
|
+
|
|
60
|
+
// REST API routes
|
|
61
|
+
app.get('/hello', (req, res) => {
|
|
62
|
+
res.json({ message: 'Hello World!' });
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
// Store and query data
|
|
66
|
+
app.post('/items', async (req, res) => {
|
|
67
|
+
const conn = await Datastore.open();
|
|
68
|
+
const result = await conn.insertOne('items', req.body);
|
|
69
|
+
res.json(result);
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
// Auto-generate CRUD REST API for any collection
|
|
73
|
+
app.crudlify();
|
|
74
|
+
|
|
75
|
+
export default app.init();
|
|
76
|
+
```
|
|
77
|
+
|
|
30
78
|
## Webhook Handler Example
|
|
31
79
|
|
|
32
80
|
Handle incoming webhooks with signature verification and reliable background processing:
|
|
@@ -103,31 +151,6 @@ app.post('/webhooks/github', async (req: httpRequest, res: httpResponse) => {
|
|
|
103
151
|
export default app.init();
|
|
104
152
|
```
|
|
105
153
|
|
|
106
|
-
## REST API Example
|
|
107
|
-
|
|
108
|
-
Build traditional REST APIs with the same simplicity:
|
|
109
|
-
|
|
110
|
-
```javascript
|
|
111
|
-
import { app, datastore } from 'codehooks-js';
|
|
112
|
-
|
|
113
|
-
app.get('/api/users/:id', async (req, res) => {
|
|
114
|
-
const conn = await datastore.open();
|
|
115
|
-
const user = await conn.getOne('users', req.params.id);
|
|
116
|
-
res.json(user);
|
|
117
|
-
});
|
|
118
|
-
|
|
119
|
-
app.post('/api/users', async (req, res) => {
|
|
120
|
-
const conn = await datastore.open();
|
|
121
|
-
const user = await conn.insertOne('users', req.body);
|
|
122
|
-
res.status(201).json(user);
|
|
123
|
-
});
|
|
124
|
-
|
|
125
|
-
// Auto-generate CRUD endpoints for any collection
|
|
126
|
-
app.crudlify();
|
|
127
|
-
|
|
128
|
-
export default app.init();
|
|
129
|
-
```
|
|
130
|
-
|
|
131
154
|
## OpenAPI Documentation
|
|
132
155
|
|
|
133
156
|
Automatically generate interactive API documentation with Swagger UI:
|
|
@@ -198,10 +221,22 @@ From the project directory run:
|
|
|
198
221
|
$ codehooks deploy
|
|
199
222
|
```
|
|
200
223
|
|
|
224
|
+
## What You Can Build
|
|
225
|
+
|
|
226
|
+
- **Webhook Handlers** – Receive and process webhooks from Stripe, Shopify, GitHub, Slack, Discord, Twilio, and any service. Built-in `request.rawBody` for signature verification.
|
|
227
|
+
- **REST APIs** – Express.js-like routing with `app.get()`, `app.post()`, etc. Full CRUD with `app.crudlify()`.
|
|
228
|
+
- **AI Agent Tool Backends** – Give your agents APIs they can call — store data, trigger workflows, query results.
|
|
229
|
+
- **Scheduled Automations** – Cron jobs that sync data, send digests, clean up records, or poll external APIs.
|
|
230
|
+
- **Multi-Step Workflows** – Chain API calls, queue tasks, and orchestrate services with the Workflow API. Automatic retries, state persistence, and error recovery.
|
|
231
|
+
- **SaaS Integrations** – Connect any service that sends webhooks. Process, transform, and route to where it matters.
|
|
232
|
+
- **Full-Stack Apps** – Deploy frontend and backend together in one package. React, static sites, or SPAs served alongside your API with zero extra config.
|
|
233
|
+
|
|
201
234
|
## Documentation
|
|
202
235
|
|
|
203
236
|
For complete documentation, visit [https://codehooks.io/docs](https://codehooks.io/docs).
|
|
204
237
|
|
|
238
|
+
For AI-optimized documentation, see [https://codehooks.io/llms.txt](https://codehooks.io/llms.txt).
|
|
239
|
+
|
|
205
240
|
## API
|
|
206
241
|
|
|
207
242
|
## Codehooks Class API Reference
|