lakebed 0.0.1
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 +94 -0
- package/package.json +62 -0
- package/src/anonymous-server.js +1078 -0
- package/src/anonymous.js +996 -0
- package/src/cli.js +1066 -0
- package/src/client.d.ts +8 -0
- package/src/client.js +154 -0
- package/src/runtime.js +252 -0
- package/src/server.d.ts +53 -0
- package/src/server.js +39 -0
- package/src/source-store.js +110 -0
package/README.md
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
# Lakebed
|
|
2
|
+
|
|
3
|
+
Lakebed is an agent-native CLI and runtime for building small full-stack TypeScript apps called capsules.
|
|
4
|
+
|
|
5
|
+
This package is an early public prototype. It includes the `lakebed` CLI, a local dev runtime, an anonymous deploy artifact compiler, and an anonymous deploy runner.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
npm install -g lakebed
|
|
11
|
+
lakebed new my-app
|
|
12
|
+
lakebed dev my-app
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Or run it without a global install:
|
|
16
|
+
|
|
17
|
+
```sh
|
|
18
|
+
npm exec --package lakebed -- lakebed new my-app
|
|
19
|
+
npm exec --package lakebed -- lakebed dev my-app
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Capsule Shape
|
|
23
|
+
|
|
24
|
+
Lakebed v0 expects this directory layout:
|
|
25
|
+
|
|
26
|
+
```txt
|
|
27
|
+
server/index.ts
|
|
28
|
+
client/index.tsx
|
|
29
|
+
shared/
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Server code imports from `lakebed/server`. Client code imports from `lakebed/client`.
|
|
33
|
+
|
|
34
|
+
```ts
|
|
35
|
+
import { capsule, mutation, query, string, table } from "lakebed/server";
|
|
36
|
+
|
|
37
|
+
export default capsule({
|
|
38
|
+
schema: {
|
|
39
|
+
messages: table({
|
|
40
|
+
body: string(),
|
|
41
|
+
authorId: string()
|
|
42
|
+
})
|
|
43
|
+
},
|
|
44
|
+
queries: {
|
|
45
|
+
messages: query((ctx) => ctx.db.messages.orderBy("createdAt", "desc").all())
|
|
46
|
+
},
|
|
47
|
+
mutations: {
|
|
48
|
+
sendMessage: mutation((ctx, body: string) =>
|
|
49
|
+
ctx.db.messages.insert({
|
|
50
|
+
body,
|
|
51
|
+
authorId: ctx.auth.userId
|
|
52
|
+
})
|
|
53
|
+
)
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Commands
|
|
59
|
+
|
|
60
|
+
```sh
|
|
61
|
+
lakebed new <name> [--template todo]
|
|
62
|
+
lakebed dev <capsule-dir> [--port 3000]
|
|
63
|
+
lakebed build <capsule-dir> --target anonymous [--out .lakebed/artifacts/app.json] [--json]
|
|
64
|
+
lakebed deploy <capsule-dir> [--ttl 7d] [--api <url>] [--json]
|
|
65
|
+
lakebed anonymous-server [--port 8787] [--public-root-url <url>]
|
|
66
|
+
lakebed inspect <deploy-id-or-url> [--api <url>] [--json]
|
|
67
|
+
lakebed db list [deploy-id-or-url] [--port 3000]
|
|
68
|
+
lakebed db dump [deploy-id-or-url] [--port 3000]
|
|
69
|
+
lakebed logs [deploy-id-or-url] [--port 3000]
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## Current Constraints
|
|
73
|
+
|
|
74
|
+
- App code can use relative imports, `lakebed/server`, `lakebed/client`, and Lakebed-provided Preact modules.
|
|
75
|
+
- Arbitrary npm imports inside capsules are not supported yet.
|
|
76
|
+
- Node built-ins are not available inside capsule modules.
|
|
77
|
+
- Tailwind classes in JSX are the only styling path in v0.
|
|
78
|
+
- Guest auth is the only auth mode.
|
|
79
|
+
- Anonymous deploys disable outbound `fetch`.
|
|
80
|
+
|
|
81
|
+
## Hosted Deploys
|
|
82
|
+
|
|
83
|
+
Once a Lakebed deploy runner is available, deploy a capsule with:
|
|
84
|
+
|
|
85
|
+
```sh
|
|
86
|
+
lakebed deploy my-app --api https://api.lakebed.app
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
For local deploy-runner testing:
|
|
90
|
+
|
|
91
|
+
```sh
|
|
92
|
+
lakebed anonymous-server --port 8787
|
|
93
|
+
lakebed deploy my-app --api http://localhost:8787
|
|
94
|
+
```
|
package/package.json
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "lakebed",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "Agent-native CLI and runtime for building and deploying Lakebed capsules.",
|
|
5
|
+
"license": "UNLICENSED",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"homepage": "https://lakebed.dev",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/pingdotgg/span.git",
|
|
11
|
+
"directory": "packages/lakebed"
|
|
12
|
+
},
|
|
13
|
+
"keywords": [
|
|
14
|
+
"agents",
|
|
15
|
+
"app-runtime",
|
|
16
|
+
"cli",
|
|
17
|
+
"lakebed"
|
|
18
|
+
],
|
|
19
|
+
"bin": {
|
|
20
|
+
"lakebed": "src/cli.js"
|
|
21
|
+
},
|
|
22
|
+
"files": [
|
|
23
|
+
"src/anonymous-server.js",
|
|
24
|
+
"src/anonymous.js",
|
|
25
|
+
"src/cli.js",
|
|
26
|
+
"src/client.d.ts",
|
|
27
|
+
"src/client.js",
|
|
28
|
+
"src/runtime.js",
|
|
29
|
+
"src/server.d.ts",
|
|
30
|
+
"src/server.js",
|
|
31
|
+
"src/source-store.js"
|
|
32
|
+
],
|
|
33
|
+
"exports": {
|
|
34
|
+
"./package.json": "./package.json",
|
|
35
|
+
"./server": {
|
|
36
|
+
"types": "./src/server.d.ts",
|
|
37
|
+
"default": "./src/server.js"
|
|
38
|
+
},
|
|
39
|
+
"./client": {
|
|
40
|
+
"types": "./src/client.d.ts",
|
|
41
|
+
"default": "./src/client.js"
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
"engines": {
|
|
45
|
+
"node": ">=20"
|
|
46
|
+
},
|
|
47
|
+
"publishConfig": {
|
|
48
|
+
"access": "public"
|
|
49
|
+
},
|
|
50
|
+
"scripts": {
|
|
51
|
+
"check": "node --check src/cli.js && node --check src/runtime.js && node --check src/server.js && node --check src/client.js && node --check src/source-store.js && node --check src/anonymous.js && node --check src/anonymous-server.js"
|
|
52
|
+
},
|
|
53
|
+
"dependencies": {
|
|
54
|
+
"esbuild": "^0.27.1",
|
|
55
|
+
"pg": "^8.16.3",
|
|
56
|
+
"preact": "^10.28.0",
|
|
57
|
+
"ws": "^8.18.3"
|
|
58
|
+
},
|
|
59
|
+
"devDependencies": {
|
|
60
|
+
"@types/ws": "^8.18.1"
|
|
61
|
+
}
|
|
62
|
+
}
|