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/cms-core

v11.2.1

Published

Aphex CMS Core - A Sanity-style CMS with ports and adapters architecture

Readme

@aphexcms/cms-core

The core engine behind AphexCMS — a Sanity-inspired, database-agnostic CMS that runs inside your SvelteKit app rather than beside it.

The same app that serves your site serves the admin, so there is no separate CMS deployment, no content API hop between them, and live preview is a route in your own project instead of an integration.

📚 Full documentation: docs.getaphex.com

Install

You'll normally get this via the scaffolder rather than by hand:

pnpm create aphex my-app

To add it to an existing SvelteKit project:

pnpm add @aphexcms/cms-core @aphexcms/ui
pnpm add @aphexcms/sqlite-adapter   # or @aphexcms/postgresql-adapter

What's in the box

  • Admin UI — a responsive three-panel editor with auto-save, validation, draft/publish, and version history.
  • Schemas in TypeScriptdocument and object types with thirteen field types, Sanity-style validation rules, and conditional visibility.
  • Portable Text — a TipTap-backed block editor with custom blocks, inline objects, marks, and annotations.
  • Four APIs over one engine — a type-safe Local API, a Zod-validated HTTP API, a generated GraphQL schema, and a Streamable HTTP MCP server.
  • Multi-tenancy — organizations with parent/child hierarchy, capability-based RBAC, and field-level access control.
  • Events and durable jobs — an append-only event log, a transactional outbox, and a database-backed job queue with leases, backoff and dead-lettering. No Redis, no broker.

Ports and adapters

cms-core defines the interfaces; separate packages implement them. That's what makes the engine database-agnostic, and it's the seam you extend.

| Port | Implementations | | ----------------- | ------------------------------------------------------------------------- | | DatabaseAdapter | @aphexcms/postgresql-adapter (incl. PGlite), @aphexcms/sqlite-adapter | | StorageAdapter | Local filesystem (built in), @aphexcms/storage-s3 | | EmailAdapter | @aphexcms/nodemailer-adapter, @aphexcms/resend-adapter | | AuthProvider | @aphexcms/auth (Better Auth), or your own | | CacheAdapter | In-memory (built in), or your own |

Usage

Adapters are constructed by your app and handed to the config — the engine never reaches for a singleton of its own:

import { createCMSConfig } from '@aphexcms/cms-core/server';
import { schemaTypes } from '$lib/schemaTypes/index.js';
import { db } from '$lib/server/db/index.js';
import { authProvider } from '$lib/server/auth/index.js';

export default createCMSConfig({
	schemaTypes,
	database: db,
	auth: { provider: authProvider, loginUrl: '/login' }
});

Then initialise the engine in your hooks, which injects the services into event.locals.aphexCMS:

import { sequence } from '@sveltejs/kit/hooks';
import { createCMSHook } from '@aphexcms/cms-core/server';
import config from '../aphex.config.js';

export const handle = sequence(authHook, createCMSHook(config));

Read content anywhere you have a request — a load, an endpoint, a job:

import { systemContext } from '@aphexcms/cms-core/local-api/auth-helpers';

export async function load({ params, locals }) {
	const [org] = await locals.aphexCMS.databaseAdapter.findAllOrganizations();
	const context = { ...systemContext(org.id), perspective: 'published' as const };

	const { docs } = await locals.aphexCMS.localAPI.collections.page.find(context, {
		where: { slug: { equals: params.slug } },
		limit: 1,
		// Strips organizationId / createdBy / updatedBy / publishedHash before this
		// reaches the hydration payload. Use it on every public-facing read.
		public: true
	});

	return { page: docs[0] };
}

Entry points

| Import | For | | ----------------------------- | --------------------------------------------------------------------- | | @aphexcms/cms-core | Plain-JS helpers and types. Svelte-free, safe to import anywhere. | | @aphexcms/cms-core/server | createCMSConfig, createCMSHook, the Local API, adapter interfaces | | @aphexcms/cms-core/client | Browser API clients and admin components | | @aphexcms/cms-core/schema | defineType and schema helpers | | @aphexcms/cms-core/image | Responsive image URL building | | @aphexcms/cms-core/vite | The aphex() Vite plugin | | @aphexcms/cms-core/routes/* | Route handlers to re-export from your own src/routes/api/ |

The root barrel is deliberately Svelte-free — anything that pulls in Svelte lives under /client, so a server-only import doesn't drag the admin bundle along with it.

CLI

The package ships an aphex binary for the two things that need to happen outside a request:

aphex generate:types ./src/lib/schemaTypes/index.ts ./src/lib/generated-types.ts ./src/lib/plugins.ts
aphex migrate

generate:types is what makes localAPI.collections.page typed. Pass the plugins path as the third argument or collections contributed by plugins stay untyped.

Requirements

  • Node.js 22+
  • SvelteKit 2 / Svelte 5

License

MIT