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

@aphexcms/postgresql-adapter

v16.0.0

Published

PostgreSQL database adapter for Aphex CMS using Drizzle ORM

Readme

@aphexcms/postgresql-adapter

PostgreSQL database adapter for AphexCMS, built on Drizzle ORM.

Implements the full DatabaseAdapter contract from @aphexcms/cms-core. Ships two drivers behind one interface: a postgres-js client for a real server, and an embedded PGlite for running Postgres semantics with no Docker and no server process.

📚 Documentation: docs.getaphex.com/database

Install

pnpm add @aphexcms/postgresql-adapter
pnpm add @electric-sql/pglite   # only for the embedded driver

Quick start

import { createPostgreSQLProvider } from '@aphexcms/postgresql-adapter';

const db = createPostgreSQLProvider({
	connectionString: process.env.DATABASE_URL
}).createAdapter();

Then hand it to createCMSConfig():

import { createCMSConfig } from '@aphexcms/cms-core/server';

export default createCMSConfig({
	schemaTypes,
	database: db
	// …
});

Embedded Postgres (PGlite)

Same adapter, same SQL, no server — persisted to a local folder. Useful when you want to develop against Postgres behaviour (row-level security in particular) without running one:

import { createPgliteProvider } from '@aphexcms/postgresql-adapter/pglite';

const db = createPgliteProvider({ dataDir: '.aphex/pgdata' }).createAdapter();

PGlite is a single-writer embedded database: a second process opening the same data directory blocks on the lock rather than failing. One process per data directory.

Migrations

Unlike the SQLite adapter, this one does not push its schema at boot — the migration history in drizzle/ is the source of truth:

aphex migrate

In production with multiple replicas, run migrations as a separate deploy step (an init container or a CI job before rollout) and set APHEX_DB_AUTO_MIGRATE=false.

Exports

| Import | Contents | | ------------------------------------- | --------------------------------------------------- | | @aphexcms/postgresql-adapter | createPostgreSQLProvider, PostgreSQLAdapter | | @aphexcms/postgresql-adapter/pglite | createPgliteProvider, createPgliteClient | | @aphexcms/postgresql-adapter/schema | The Drizzle schema (cms_documents, cms_jobs, …) |

Note on development

This package is consumed from dist, not from source — so a change here needs a rebuild and a dev-server restart before the studio sees it. cms-core is the exception to that rule, not the norm.

License

MIT