create-pds 0.0.1 → 0.0.2
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/dist/index.js +2717 -0
- package/dist/prompt-CJttWhPO.js +847 -0
- package/package.json +36 -7
- package/templates/pds-worker/README.md +92 -0
- package/templates/pds-worker/env.example +27 -0
- package/templates/pds-worker/gitignore +5 -0
- package/templates/pds-worker/package.json.tmpl +27 -0
- package/templates/pds-worker/src/index.ts +2 -0
- package/templates/pds-worker/vite.config.ts +12 -0
- package/templates/pds-worker/wrangler.jsonc +50 -0
- package/index.js +0 -4
package/package.json
CHANGED
|
@@ -1,11 +1,40 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-pds",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"description": "Create a new PDS
|
|
3
|
+
"version": "0.0.2",
|
|
4
|
+
"description": "Create a new AT Protocol PDS on Cloudflare Workers",
|
|
5
|
+
"type": "module",
|
|
5
6
|
"bin": {
|
|
6
|
-
"create-pds": "./index.js"
|
|
7
|
+
"create-pds": "./dist/index.js"
|
|
7
8
|
},
|
|
8
|
-
"
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
"files": [
|
|
10
|
+
"dist",
|
|
11
|
+
"templates"
|
|
12
|
+
],
|
|
13
|
+
"devDependencies": {
|
|
14
|
+
"@clack/prompts": "^0.11.0",
|
|
15
|
+
"@types/node": "^24.10.4",
|
|
16
|
+
"citty": "^0.1.6",
|
|
17
|
+
"publint": "^0.3.16",
|
|
18
|
+
"tsdown": "^0.18.3",
|
|
19
|
+
"typescript": "^5.9.3"
|
|
20
|
+
},
|
|
21
|
+
"repository": {
|
|
22
|
+
"type": "git",
|
|
23
|
+
"url": "git+https://github.com/ascorbic/atproto-worker.git",
|
|
24
|
+
"directory": "packages/create-pds"
|
|
25
|
+
},
|
|
26
|
+
"homepage": "https://github.com/ascorbic/atproto-worker",
|
|
27
|
+
"keywords": [
|
|
28
|
+
"atproto",
|
|
29
|
+
"bluesky",
|
|
30
|
+
"pds",
|
|
31
|
+
"cloudflare-workers"
|
|
32
|
+
],
|
|
33
|
+
"author": "Matt Kane",
|
|
34
|
+
"license": "MIT",
|
|
35
|
+
"scripts": {
|
|
36
|
+
"build": "tsdown",
|
|
37
|
+
"test": "vitest run",
|
|
38
|
+
"check": "publint"
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# Personal PDS on Cloudflare Workers
|
|
2
|
+
|
|
3
|
+
A single-user AT Protocol Personal Data Server running on Cloudflare Workers.
|
|
4
|
+
|
|
5
|
+
> **⚠️ Experimental Software**
|
|
6
|
+
>
|
|
7
|
+
> This is an early-stage project under active development. **Do not migrate your main Bluesky account to this PDS yet.** Use a test account or create a new identity for experimentation.
|
|
8
|
+
|
|
9
|
+
## Setup
|
|
10
|
+
|
|
11
|
+
### 1. Install dependencies
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
pnpm install
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
### 2. Configure environment
|
|
18
|
+
|
|
19
|
+
If you haven't already, run the setup wizard:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
pnpm pds init
|
|
23
|
+
# or
|
|
24
|
+
npm run pds init
|
|
25
|
+
yarn pds init
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
This prompts for your hostname, handle, and password, then writes configuration to `.dev.vars`.
|
|
29
|
+
|
|
30
|
+
### 3. Run locally
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
pnpm dev
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
This starts a local development server at http://localhost:5173.
|
|
37
|
+
|
|
38
|
+
### 4. Deploy to production
|
|
39
|
+
|
|
40
|
+
First configure for production:
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
pnpm pds init --production
|
|
44
|
+
|
|
45
|
+
# or
|
|
46
|
+
npm run pds init --production
|
|
47
|
+
yarn pds init --production
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
This sets vars in `wrangler.jsonc` and secrets via `wrangler secret put`.
|
|
51
|
+
|
|
52
|
+
Then deploy:
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
pnpm run deploy
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Configuration
|
|
59
|
+
|
|
60
|
+
Configuration uses environment variables: vars in `wrangler.jsonc` and secrets.
|
|
61
|
+
|
|
62
|
+
**Vars (in wrangler.jsonc):**
|
|
63
|
+
|
|
64
|
+
- `PDS_HOSTNAME` - Public hostname of the PDS
|
|
65
|
+
- `DID` - Account DID (e.g., did:web:pds.example.com)
|
|
66
|
+
- `HANDLE` - Account handle (e.g., alice.example.com)
|
|
67
|
+
- `SIGNING_KEY_PUBLIC` - Public key for DID document (multibase)
|
|
68
|
+
|
|
69
|
+
**Secrets (via wrangler):**
|
|
70
|
+
|
|
71
|
+
- `AUTH_TOKEN` - Bearer token for API write operations
|
|
72
|
+
- `SIGNING_KEY` - Private signing key (secp256k1 JWK)
|
|
73
|
+
- `JWT_SECRET` - Secret for signing session JWTs
|
|
74
|
+
- `PASSWORD_HASH` - Bcrypt hash of account password (for Bluesky app login)
|
|
75
|
+
|
|
76
|
+
## Endpoints
|
|
77
|
+
|
|
78
|
+
Once deployed, your PDS serves:
|
|
79
|
+
|
|
80
|
+
- `GET /.well-known/did.json` - DID document
|
|
81
|
+
- `GET /health` - Health check
|
|
82
|
+
- `GET /xrpc/com.atproto.sync.getRepo` - Export repository as CAR
|
|
83
|
+
- `GET /xrpc/com.atproto.sync.subscribeRepos` - WebSocket firehose
|
|
84
|
+
- `POST /xrpc/com.atproto.repo.createRecord` - Create a record (authenticated)
|
|
85
|
+
- `POST /xrpc/com.atproto.repo.uploadBlob` - Upload a blob (authenticated)
|
|
86
|
+
- And more...
|
|
87
|
+
|
|
88
|
+
## Resources
|
|
89
|
+
|
|
90
|
+
- [AT Protocol Docs](https://atproto.com)
|
|
91
|
+
- [Cloudflare Workers Docs](https://developers.cloudflare.com/workers/)
|
|
92
|
+
- [@ascorbic/pds on GitHub](https://github.com/ascorbic/atproto-worker)
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# Example environment variables for local development
|
|
2
|
+
# Copy this to .dev.vars and fill in your values
|
|
3
|
+
# Or run `pnpm pds init --local` to generate automatically
|
|
4
|
+
|
|
5
|
+
# Public hostname of your PDS
|
|
6
|
+
PDS_HOSTNAME=demo-pds.example.com
|
|
7
|
+
|
|
8
|
+
# Your account's DID (usually did:web:{PDS_HOSTNAME})
|
|
9
|
+
DID=did:web:demo-pds.example.com
|
|
10
|
+
|
|
11
|
+
# Your account's handle
|
|
12
|
+
HANDLE=alice.demo-pds.example.com
|
|
13
|
+
|
|
14
|
+
# Bearer token for write operations (generate a random string)
|
|
15
|
+
AUTH_TOKEN=your-secret-token-here
|
|
16
|
+
|
|
17
|
+
# Private key for signing commits (secp256k1 JWK)
|
|
18
|
+
SIGNING_KEY={"kty":"EC","crv":"secp256k1","x":"...","d":"..."}
|
|
19
|
+
|
|
20
|
+
# Public key for DID document (multibase encoded)
|
|
21
|
+
SIGNING_KEY_PUBLIC=zQ3sh...
|
|
22
|
+
|
|
23
|
+
# Secret for signing session JWTs (generate a random string)
|
|
24
|
+
JWT_SECRET=your-jwt-secret-here
|
|
25
|
+
|
|
26
|
+
# Optional: Bcrypt hash of account password (for app login)
|
|
27
|
+
# PASSWORD_HASH=$2a$10$...
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "{{name}}",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "AT Protocol PDS on Cloudflare Workers",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"private": true,
|
|
7
|
+
"dependencies": {
|
|
8
|
+
"@ascorbic/pds": "^0.0.0"
|
|
9
|
+
},
|
|
10
|
+
"devDependencies": {
|
|
11
|
+
"@cloudflare/vite-plugin": "^1.17.0",
|
|
12
|
+
"vite": "^6.4.1",
|
|
13
|
+
"wrangler": "^4.54.0"
|
|
14
|
+
},
|
|
15
|
+
"scripts": {
|
|
16
|
+
"dev": "vite dev",
|
|
17
|
+
"build": "vite build",
|
|
18
|
+
"deploy": "vite build && wrangler deploy",
|
|
19
|
+
"preview": "vite preview",
|
|
20
|
+
"pds": "pds",
|
|
21
|
+
"wrangler": "wrangler",
|
|
22
|
+
"types": "wrangler types"
|
|
23
|
+
},
|
|
24
|
+
"keywords": [],
|
|
25
|
+
"author": "",
|
|
26
|
+
"license": "MIT"
|
|
27
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { defineConfig } from "vite";
|
|
2
|
+
import { cloudflare } from "@cloudflare/vite-plugin";
|
|
3
|
+
|
|
4
|
+
export default defineConfig({
|
|
5
|
+
plugins: [cloudflare()],
|
|
6
|
+
resolve: {
|
|
7
|
+
alias: {
|
|
8
|
+
// Required for dev mode - pino (used by @atproto) doesn't work in Workers
|
|
9
|
+
pino: "pino/browser.js",
|
|
10
|
+
},
|
|
11
|
+
},
|
|
12
|
+
});
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
{
|
|
2
|
+
// AT Protocol PDS on Cloudflare Workers
|
|
3
|
+
// Run `pnpm pds init` to configure, or `pnpm pds init --production` to deploy secrets
|
|
4
|
+
"name": "atproto-pds",
|
|
5
|
+
"main": "src/index.ts",
|
|
6
|
+
"compatibility_date": "2025-12-02",
|
|
7
|
+
"compatibility_flags": [
|
|
8
|
+
"nodejs_compat"
|
|
9
|
+
],
|
|
10
|
+
// Durable Object bindings
|
|
11
|
+
"durable_objects": {
|
|
12
|
+
"bindings": [
|
|
13
|
+
{
|
|
14
|
+
"name": "ACCOUNT",
|
|
15
|
+
"class_name": "AccountDurableObject"
|
|
16
|
+
}
|
|
17
|
+
]
|
|
18
|
+
},
|
|
19
|
+
// Enable SQLite for the Durable Object
|
|
20
|
+
"migrations": [
|
|
21
|
+
{
|
|
22
|
+
"tag": "v1",
|
|
23
|
+
"new_sqlite_classes": [
|
|
24
|
+
"AccountDurableObject"
|
|
25
|
+
]
|
|
26
|
+
}
|
|
27
|
+
],
|
|
28
|
+
// R2 bucket for blob storage (optional - create via Cloudflare dashboard)
|
|
29
|
+
"r2_buckets": [
|
|
30
|
+
{
|
|
31
|
+
"binding": "BLOBS",
|
|
32
|
+
"bucket_name": "pds-blobs"
|
|
33
|
+
}
|
|
34
|
+
],
|
|
35
|
+
// Environment variables (public config)
|
|
36
|
+
// These are set by `pds init` or can be edited manually
|
|
37
|
+
"vars": {
|
|
38
|
+
// Public hostname of the PDS (e.g., "pds.example.com")
|
|
39
|
+
"PDS_HOSTNAME": "",
|
|
40
|
+
// Account DID - usually did:web:<hostname>
|
|
41
|
+
"DID": "",
|
|
42
|
+
// Account handle (e.g., "alice.example.com")
|
|
43
|
+
"HANDLE": ""
|
|
44
|
+
}
|
|
45
|
+
// Secrets (set via `pds init` or `pds secret <name>`):
|
|
46
|
+
// - AUTH_TOKEN: Bearer token for API write operations
|
|
47
|
+
// - SIGNING_KEY: Private signing key (secp256k1 JWK)
|
|
48
|
+
// - JWT_SECRET: Secret for signing session JWTs
|
|
49
|
+
// - PASSWORD_HASH: Bcrypt hash of account password (for Bluesky app login)
|
|
50
|
+
}
|
package/index.js
DELETED