~ knotless Search/
↑↓ move↵ open⇧↵ all results

chadtmiller.com/pds.js

An atproto PDS in JavaScript, for Cloudflare Workers and Node

0
0
main
116 lines · 3.4 KB Raw History

README and Documentation Update

Overview

Update README and setup documentation to reflect multi-platform support (Node.js and Cloudflare Workers).

Design Decisions

  • Tagline: Platform-agnostic ("A minimal AT Protocol Personal Data Server written in JavaScript")
  • Quick Start: Node.js focused (simpler, no account required)
  • Platform guides: Sections in README (not separate pages)
  • Setup script: Single flow for both platforms
  • Audience: Developers evaluating, self-hosters, contributors

README Structure

1. Header and Overview

  • New tagline without Cloudflare-specific language
  • Feature list with link to endpoint comparison
  • Mention both platform options

2. Quick Start (Node.js)

git clone https://github.com/your/pds.js
cd pds.js && npm install
npm run dev:node
npm run setup -- --pds http://localhost:3000

3. Configuration

Environment variables table:

VariableRequiredDescription
PDS_PASSWORDYesPassword for legacy auth and OAuth consent
JWT_SECRETYesSecret for signing JWTs
PDS_DB_PATHNoSQLite database path (default: ./pds.db)
PDS_BLOBS_DIRNoBlob storage directory (default: ./blobs)
PORTNoServer port (default: 3000)
HOSTNAMENoPublic hostname for the PDS
APPVIEW_URLNoAppView URL for proxying
APPVIEW_DIDNoAppView DID for service auth
RELAY_URLNoRelay URL for firehose notifications

4. Deploy: Node.js

  • Install dependencies
  • Configure environment variables
  • Start server (packages/node entry or examples/node)
  • Run setup script
  • DNS/TLS notes (reverse proxy)
  • Storage considerations

5. Deploy: Cloudflare Workers

  • Prerequisites (Workers Paid plan)
  • Create R2 bucket and KV namespace
  • Configure wrangler.toml (including SHARED_KV binding)
  • Set secrets
  • Deploy
  • Run setup script

6. Testing

npm test                    # Unit tests
npm run test:e2e:node       # E2E against Node.js
npm run test:e2e:cloudflare # E2E against Cloudflare
npm run test:coverage       # Coverage

7. Architecture

  • Hexagonal architecture diagram
  • Ports explanation:
    • ActorStoragePort (per-user data)
    • SharedStoragePort (global data)
    • BlobPort (binary storage)
    • WebSocketPort (real-time)

8. Packages

Table of all packages with descriptions:

  • @pdsjs/core
  • @pdsjs/node
  • @pdsjs/cloudflare
  • @pdsjs/storage-better-sqlite3
  • @pdsjs/blobs-fs
  • @pdsjs/blobs-s3

Basic usage examples for Node.js and Cloudflare.

9. Contributing

  • PR requirements (tests, format, typecheck)
  • Development commands
  • Project structure overview

Additional Tasks

  1. Update examples/cloudflare/wrangler.toml to include KV namespace binding
  2. Add npm run dev:node script to package.json
  3. Add npm run dev:cloudflare script to package.json
  4. Update .env.example to include Node.js-specific variables

Implementation Plan

Task 1: Update package.json scripts

Add dev:node and dev:cloudflare scripts.

Task 2: Update examples/cloudflare/wrangler.toml

Add SHARED_KV binding placeholder.

Task 3: Update .env.example

Add Node.js-specific variables.

Task 4: Rewrite README.md

Replace current Cloudflare-focused README with new multi-platform version.

Verification

  • Run npm test to ensure nothing broken
  • Run npm run dev:node to verify script works
  • Review README renders correctly