@preprio/toolkit

Prepr personalization, A/B testing and preview toolkit for React, Next.js, Nuxt, Astro, SvelteKit and Express
8,356 1
Install
npm install @preprio/toolkit
Latest Version:0.4.3
Vue:3
License:Apache-2.0
Last Updated:Oct 21, 2026
Links: GitHub  ·  npm

Prepr Toolkit

A framework-agnostic TypeScript library that provides preview functionality, visual editing, and A/B testing for Prepr CMS. One vanilla core, with thin wrappers for React, Next.js, Nuxt, Astro, and SvelteKit.

This is the monorepo. The published package lives in packages/toolkit — its README is the user-facing documentation: quick start, per-framework guides, and the complete API reference.

Quick Start

npm install @preprio/toolkit

Then follow the Quick Start for your framework: Next.js, Astro, SvelteKit, Nuxt, React, or anything else.

Upgrading from the old Next.js-only @preprio/prepr-nextjs package? See the migration guide.

What's In Here

Path Description
packages/toolkit The published @preprio/toolkit package — vanilla core plus the Next.js, Nuxt, Astro, and SvelteKit wrappers.
examples/nextjs App Router, middleware, Apollo Client, custom image loader.
examples/astro Astro middleware and the .astro components.
examples/sveltekit hooks.server.ts, +layout.server.ts, the .svelte components.
examples/nuxt Nitro middleware, runtimeConfig, the .vue components.
examples/express Vanilla core — a hand-written adapter for an unsupported framework.
MIGRATION.md Upgrading from @preprio/prepr-nextjs to @preprio/toolkit.

A pnpm workspace (packages/*, examples/*) built with Turborepo.

Running the Examples

Each example needs its own .env. Copy the template and fill in your Prepr GraphQL URL (Settings → Access tokens in Prepr):

cp examples/nextjs/.env.example examples/nextjs/.env

Install once at the root, build the package, then start the example you want:

pnpm install
pnpm build
pnpm --filter example-nextjs dev

The other examples follow the same pattern — example-astro, example-sveltekit, example-nuxt, example-express.

Development

pnpm install       # install all workspace dependencies
pnpm build         # build the published packages
pnpm test          # run the test suites
pnpm typecheck     # typecheck the published packages

These cover packages/* only — they are what the release workflow runs, so a release is never blocked by an example. The examples have their own commands:

pnpm build:examples       # build every example
pnpm typecheck:examples   # typecheck every example
pnpm check:all            # everything, packages and examples

The examples build and typecheck without a .env (examples/sveltekit reads PUBLIC_PREPR_GRAPHQL_URL through $env/dynamic/public at runtime, so nothing has to exist at compile time). They stay out of the release path anyway: a broken example should never block publishing the packages.

All commands run through Turborepo, so they are cached and only re-run what changed. To scope one to a single workspace:

pnpm --filter @preprio/toolkit test

The toolbar's CSS is compiled from .css sources into *.generated.ts files by scripts/compile-css.mjs. This runs automatically before build, test, and typecheck — the generated files are gitignored, so a fresh clone has none until you run one of those commands.

There is no CI on pushes or pull requests: checks run only when you push a v* tag, as the first half of the Release workflow. Nothing verifies a branch for you, so run pnpm check:all locally before you push — a mistake that reaches main stays invisible until someone cuts a release.

Releasing

Push a v* tag and the Release workflow lints, typechecks, tests, builds and publishes to npm. See RELEASING.md for the full walkthrough.

Support

Related Packages

@easy-cms/core

Embedded, code-first headless CMS for Nuxt and Next.js

25,029 2
create-contioreach-blog

Create a blog wired to ContioReach in one command. Pick Next.js, Nuxt, Astro, Sv...

479 0
payload-live-preview

Live preview for Payload CMS on server-rendered and static frontends: DOM patche...

5,016 6
@inneropen/marvin-sdk

Official TypeScript SDK for Marvin CMS

19,254 0
@cosmicjs/sdk

Official JavaScript SDK for Cosmic. Fetch content, manage media, and generate AI...

129,302 18

Version History

Version Released License
0.4.3 Apache-2.0
0.4.2 Apache-2.0
0.4.1 Apache-2.0
0.4.0 Apache-2.0
0.3.5 Apache-2.0
Pre-releases (25)
Version Released License
0.6.0-alpha.10 Apache-2.0
0.6.0-alpha.9 Apache-2.0
0.6.0-alpha.8 Apache-2.0
0.6.0-alpha.7 Apache-2.0
0.6.0-alpha.6 Apache-2.0