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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@mdxdb/payload

v1.9.0

Published

Payload CMS database adapter for mdxdb - supports SQLite (Durable Objects) and ClickHouse backends on Cloudflare Workers

Readme

@mdxdb/payload

Payload CMS database adapter for mdxdb - supports SQLite (Durable Objects) and ClickHouse backends on Cloudflare Workers.

Installation

pnpm add @mdxdb/payload payload

Usage

SQLite Adapter (Durable Objects)

import { buildConfig } from 'payload'
import { sqliteAdapter, getNativeCollections } from '@mdxdb/payload'

export default buildConfig({
  db: sqliteAdapter({
    binding: env.MDXDB,
    namespace: 'example.com',
  }),
  collections: [
    ...getNativeCollections(),
    // Your custom collections
  ],
})

ClickHouse Adapter

import { buildConfig } from 'payload'
import { clickhouseAdapter } from '@mdxdb/payload/clickhouse'

export default buildConfig({
  db: clickhouseAdapter({
    url: env.CLICKHOUSE_URL,
    username: env.CLICKHOUSE_USERNAME,
    password: env.CLICKHOUSE_PASSWORD,
    namespace: 'example.com',
  }),
  collections: [...],
})

Native Collections

mdxdb's core entities can be exposed as Payload collections:

import { getNativeCollections } from '@mdxdb/payload'

// Include all native collections
const collections = getNativeCollections()

// Or select specific ones
const collections = getNativeCollections({
  things: true,        // Graph nodes
  relationships: true, // Graph edges
  search: true,        // Indexed content with embeddings
  events: true,        // Immutable event log
  actions: true,       // Jobs/Tasks/Workflows queue
  artifacts: true,     // Cached compiled content
})

Available Collections

| Collection | Description | |------------|-------------| | things | Graph nodes - the core entity type | | relationships | Graph edges connecting Things | | search | Indexed content with vector embeddings | | events | Immutable event log (audit/analytics) | | actions | Jobs queue - Tasks, Workflows, Background Jobs | | artifacts | Cached compiled content and build artifacts |

Virtual Collections

Create Payload collections that map to mdxdb Thing types:

import { createVirtualCollection } from '@mdxdb/payload'

const PostsCollection = createVirtualCollection({
  slug: 'posts',
  type: 'Post',
  fields: [
    {
      name: 'author',
      type: 'relationship',
      relationTo: 'users',
    },
    {
      name: 'tags',
      type: 'json',
    },
  ],
})

How It Works

Collections → Things

Payload documents are stored as mdxdb Things:

  • Collection slug → Thing type (PascalCase)
  • Document ID → Thing ID
  • Document data → Thing data
  • Timestamps → Thing timestamps

Relationships → Graph Edges

Payload relationship fields are converted to mdxdb Relationships:

  • Each relationship field creates an edge
  • hasMany creates multiple edges
  • Join fields query reverse relationships

Jobs/Tasks → Actions

Payload's jobs queue maps to mdxdb Actions:

  • Jobs → Actions with status: 'pending'
  • Tasks → Actions with verb conjugations (act, action, activity)
  • Workflows → Actions with parent/children hierarchy

Versions → Branches

Payload's version history maps to mdxdb's branching:

  • Drafts → Things with branch: 'draft'
  • Published → Things with branch: 'main'
  • Version history → Thing versions within branch

API

sqliteAdapter(config)

Create a SQLite adapter using Durable Objects.

interface SQLiteAdapterConfig {
  binding: DurableObjectNamespace  // env.MDXDB
  namespace?: string               // Default namespace
  idType?: 'uuid' | 'number'       // ID type
  debug?: boolean                  // Enable debug logging
}

clickhouseAdapter(config)

Create a ClickHouse adapter using HTTP.

interface ClickHouseAdapterConfig {
  url: string                    // ClickHouse HTTP URL
  username?: string              // Authentication
  password?: string
  database?: string              // Database name (default: mdxdb)
  namespace?: string             // Default namespace
  cacheTtl?: number              // Cache TTL in seconds
  debug?: boolean
}

getNativeCollections(options)

Get Payload collections for mdxdb's native entities.

createVirtualCollection(options)

Create a Payload collection backed by mdxdb Things of a specific type.

License

MIT