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

chadtmiller.com/pds.js

An atproto PDS in JavaScript, for Cloudflare Workers and Node

0
0
main
55 lines · 1.3 KB Raw History
# Deploy: Deno

The Deno server stores the repo in `node:sqlite` and the blobs on local disk. It
needs Deno 2.2 or later for `node:sqlite`.

## Run it

```bash
cd examples/deno
deno run --allow-net --allow-read --allow-write --allow-env main.ts
```

The server needs four permissions:

| Permission | Reason |
|------------|--------|
| `--allow-net` | The HTTP server, and outbound requests to the PLC, relay, and AppView |
| `--allow-read` | The database and the blob files |
| `--allow-write` | The database and the blob files |
| `--allow-env` | The configuration |

`examples/deno/main.ts` closes the database on SIGINT and SIGTERM.

## As a library

```typescript
import { createServer } from '@pdsjs/deno'

const { listen } = await createServer({
  dbPath: './pds.db',
  blobsDir: './blobs',
  jwtSecret: Deno.env.get('JWT_SECRET'),
  hostname: 'your-hostname.com',
  port: 3000,
})

await listen()
```

## Finish the setup

Terminate TLS with a reverse proxy such as nginx or Caddy. Set `HOSTNAME` to the
public domain.

Then register the DID with the PLC directory. Run this once, after the PDS
answers at its public URL:

```bash
npm run setup -- --pds https://your-hostname.com
```

## Configuration

`examples/deno/README.md` lists the variables the example reads. The names match
the Node server. See [configuration](configuration.md).