creek 0.3.9 → 0.3.11
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 +126 -0
- package/package.json +4 -3
package/README.md
ADDED
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
# creek
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/creek)
|
|
4
|
+
[](https://github.com/solcreek/creek)
|
|
5
|
+
|
|
6
|
+
Deploy full-stack apps to the edge. Database, realtime sync, and AI — all built in.
|
|
7
|
+
|
|
8
|
+
## Install
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
npx creek deploy
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
Or install globally:
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
npm install -g creek
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Deploy
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
creek deploy # Auto-detect framework, build, deploy
|
|
24
|
+
creek deploy --demo # Deploy a sample site in seconds
|
|
25
|
+
creek deploy ./dist # Deploy a pre-built directory
|
|
26
|
+
creek dev # Local development server
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Server Runtime
|
|
30
|
+
|
|
31
|
+
```ts
|
|
32
|
+
import { db, kv, storage, ai } from "creek";
|
|
33
|
+
|
|
34
|
+
// Database — managed D1, no config needed
|
|
35
|
+
const users = await db.query("SELECT * FROM users");
|
|
36
|
+
await db.mutate("INSERT INTO users (id, name) VALUES (?, ?)", id, name);
|
|
37
|
+
|
|
38
|
+
// Define tables — auto-created on first request (powered by d1-schema)
|
|
39
|
+
db.define({
|
|
40
|
+
users: {
|
|
41
|
+
id: "text primary key",
|
|
42
|
+
email: "text unique not null",
|
|
43
|
+
name: "text not null",
|
|
44
|
+
},
|
|
45
|
+
});
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### Schema with d1-schema
|
|
49
|
+
|
|
50
|
+
Use [`d1-schema`](https://www.npmjs.com/package/d1-schema) for declarative table definitions:
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
npm install d1-schema
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
```ts
|
|
57
|
+
import { define } from "d1-schema";
|
|
58
|
+
|
|
59
|
+
await define(env.DB, {
|
|
60
|
+
todos: {
|
|
61
|
+
id: "text primary key",
|
|
62
|
+
text: "text not null",
|
|
63
|
+
completed: "integer default 0",
|
|
64
|
+
_indexes: ["completed"],
|
|
65
|
+
},
|
|
66
|
+
});
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Tables auto-created on first use. No migration files, no CLI commands.
|
|
70
|
+
|
|
71
|
+
## Realtime
|
|
72
|
+
|
|
73
|
+
```ts
|
|
74
|
+
import { LiveRoom, useLiveQuery, usePresence } from "creek/react";
|
|
75
|
+
|
|
76
|
+
function App() {
|
|
77
|
+
return (
|
|
78
|
+
<LiveRoom id={roomId}>
|
|
79
|
+
<TodoApp />
|
|
80
|
+
</LiveRoom>
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
function TodoApp() {
|
|
85
|
+
const { data: todos, mutate } = useLiveQuery("/api/todos", {
|
|
86
|
+
initialData: [],
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
const addTodo = (text) =>
|
|
90
|
+
mutate(
|
|
91
|
+
{ method: "POST", path: "/api/todos", body: { text } },
|
|
92
|
+
(prev) => [{ text, completed: 0 }, ...prev],
|
|
93
|
+
);
|
|
94
|
+
}
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
## Hono Middleware
|
|
98
|
+
|
|
99
|
+
```ts
|
|
100
|
+
import { room } from "creek/hono";
|
|
101
|
+
|
|
102
|
+
app.use("/api/*", room());
|
|
103
|
+
// c.var.room is now available — broadcasts scoped to this room
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
## CLI Commands
|
|
107
|
+
|
|
108
|
+
| Command | Description |
|
|
109
|
+
|---------|-------------|
|
|
110
|
+
| `creek deploy` | Deploy to production |
|
|
111
|
+
| `creek dev` | Local development server |
|
|
112
|
+
| `creek rollback` | Rollback to previous deployment |
|
|
113
|
+
| `creek domains` | Manage custom domains |
|
|
114
|
+
| `creek env` | Manage environment variables |
|
|
115
|
+
| `creek login` | Authenticate |
|
|
116
|
+
| `creek init` | Initialize a new project |
|
|
117
|
+
|
|
118
|
+
## Links
|
|
119
|
+
|
|
120
|
+
- [Documentation](https://creek.dev/docs)
|
|
121
|
+
- [GitHub](https://github.com/solcreek/creek)
|
|
122
|
+
- [d1-schema](https://www.npmjs.com/package/d1-schema) — Declarative D1 schema management
|
|
123
|
+
|
|
124
|
+
## License
|
|
125
|
+
|
|
126
|
+
Apache-2.0
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "creek",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.11",
|
|
4
4
|
"description": "The Creek deployment platform — CLI and runtime",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -30,7 +30,8 @@
|
|
|
30
30
|
"react.d.ts",
|
|
31
31
|
"hono.js",
|
|
32
32
|
"hono.d.ts",
|
|
33
|
-
"LICENSE"
|
|
33
|
+
"LICENSE",
|
|
34
|
+
"README.md"
|
|
34
35
|
],
|
|
35
36
|
"keywords": [
|
|
36
37
|
"creek",
|
|
@@ -48,7 +49,7 @@
|
|
|
48
49
|
"directory": "packages/creek"
|
|
49
50
|
},
|
|
50
51
|
"dependencies": {
|
|
51
|
-
"@solcreek/cli": "
|
|
52
|
+
"@solcreek/cli": ">=0.3.7",
|
|
52
53
|
"@solcreek/runtime": "^0.2.3"
|
|
53
54
|
}
|
|
54
55
|
}
|