npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

fake-pds

v0.7.0

Published

Lightweight in-memory AT Protocol PDS for testing

Downloads

67

Readme

fake-pds

A lightweight, in-memory AT Protocol PDS for testing. No database, no crypto verification, no Merkle Search Tree — just the XRPC endpoints that matter for integration tests.

Install

npm install fake-pds

Quick Start

import { createFakePds } from "fake-pds";

const pds = await createFakePds({
  accounts: [
    { did: "did:plc:alice", handle: "alice.test" },
    { did: "did:plc:bob", handle: "bob.test" },
  ],
});

// Seed data
pds.putRecord("did:plc:alice", "app.opake.publicKey", "self", {
  opakeVersion: 1,
  publicKey: { $bytes: "..." },
  algo: "x25519",
  createdAt: "2026-01-01T00:00:00Z",
});

// Use in tests — it's a real HTTP server
const res = await fetch(
  `${pds.url}/xrpc/com.atproto.repo.getRecord?repo=did:plc:alice&collection=app.opake.publicKey&rkey=self`,
);
const record = await res.json();

// Reset between tests
pds.reset();

// Cleanup
await pds.close();

Endpoints

Repository (XRPC)

| Endpoint | Method | Auth | Notes | |----------|--------|------|-------| | com.atproto.repo.getRecord | GET | No | Returns { uri, cid, value } or 404 | | com.atproto.repo.listRecords | GET | No | Cursor pagination, sorted by rkey | | com.atproto.repo.createRecord | POST | Yes | Auto-generates TID rkey if omitted | | com.atproto.repo.putRecord | POST | Yes | Upsert by rkey | | com.atproto.repo.deleteRecord | POST | Yes | No-ops if missing | | com.atproto.repo.uploadBlob | POST | Yes | Returns blob ref | | com.atproto.sync.getBlob | GET | No | Returns stored blob bytes |

Identity

| Endpoint | Method | Auth | Notes | |----------|--------|------|-------| | com.atproto.identity.resolveHandle | GET | No | Returns { did } or 404 |

Auth (Legacy)

| Endpoint | Method | Notes | |----------|--------|-------| | com.atproto.server.createSession | POST | Returns fake JWT tokens | | com.atproto.server.refreshSession | POST | Invalidates old tokens |

OAuth

| Endpoint | Method | Notes | |----------|--------|-------| | /.well-known/oauth-protected-resource | GET | Static metadata | | /.well-known/oauth-authorization-server | GET | Server metadata | | /oauth/par | POST | PAR, returns request_uri + DPoP nonce | | /oauth/token | POST | Code exchange or refresh, returns DPoP tokens |

Auth Modes

// No auth checking — fastest for unit tests
const pds = await createFakePds({ auth: "none" });

// Bearer token auth (legacy JWT flow)
const pds = await createFakePds({ auth: "bearer" });

// OAuth with DPoP nonce tracking
const pds = await createFakePds({ auth: "oauth" });

Legacy Auth

const pds = await createFakePds({
  accounts: [{ did: "did:plc:alice", handle: "alice.test" }],
  auth: "bearer",
});

// Login
const loginRes = await fetch(`${pds.url}/xrpc/com.atproto.server.createSession`, {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({ identifier: "alice.test", password: "anything" }),
});
const { accessJwt } = await loginRes.json();

// Authenticated request
await fetch(`${pds.url}/xrpc/com.atproto.repo.putRecord`, {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    Authorization: `Bearer ${accessJwt}`,
  },
  body: JSON.stringify({ repo: "did:plc:alice", collection: "app.test", rkey: "x", record: {} }),
});

OAuth (Direct Token Issuance)

Skip the browser redirect flow entirely:

const pds = await createFakePds({
  accounts: [{ did: "did:plc:alice", handle: "alice.test" }],
  auth: "oauth",
});

// Get tokens directly — no browser flow needed
const { accessToken, refreshToken, dpopNonce } = pds.issueOAuthTokens("did:plc:alice");

// Use with DPoP header
await fetch(`${pds.url}/xrpc/com.atproto.repo.putRecord`, {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    Authorization: `DPoP ${accessToken}`,
  },
  body: JSON.stringify({ repo: "did:plc:alice", collection: "app.test", rkey: "x", record: {} }),
});

API

createFakePds(options?): Promise<FakePds>

Create and start a fake PDS.

| Option | Type | Default | Description | |--------|------|---------|-------------| | port | number | 0 (random) | Port to listen on | | accounts | Account[] | [] | Pre-registered accounts | | auth | "none" \| "bearer" \| "oauth" | "none" | Auth enforcement mode |

FakePds

| Method | Description | |--------|-------------| | url | Base URL of the running server | | putRecord(did, collection, rkey, value) | Seed a record (bypasses auth) | | listRecords(did, collection) | List records for test inspection | | issueOAuthTokens(did) | Get OAuth tokens directly | | reset() | Clear all records, blobs, and sessions | | close() | Stop the server |

Account

interface Account {
  did: string;
  handle: string;
  password?: string; // If set, createSession validates it
}

What This Doesn't Do

  • No Merkle Search Tree or commit history
  • No record validation against lexicon schemas
  • No federation, sync, or firehose
  • No DID document hosting
  • No PKCE or DPoP signature verification
  • CIDs are fake (sha256-based, not real IPFS CIDs)

These are intentional tradeoffs. The goal is fast, reliable integration tests — not a spec-complete PDS.

License

AGPL-3.0-or-later