Installation
Requirements, peer dependencies and how to install the payload-experiments release candidate.
The plugin runs inside an existing Payload 3 app on the Next.js App Router, with Postgres as the database.
Release candidate
The current version is 0.4.0-rc.3. Prereleases are published under the npm rc dist-tag, so install with @rc or pin an exact version. The plugin is pre-1.0 and a minor release can require changes; check Upgrading when you update.
npm i @delmaredigital/payload-experiments@rc pg @payloadcms/db-postgres @delmaredigital/payload-puck @puckeditor/coreTo pin the exact version instead:
npm i @delmaredigital/payload-experiments@0.4.0-rc.3The quick start uses Puck and pg directly, so the first command includes them. For TypeScript, install the Postgres types too:
npm i -D @types/pgThe statistics engine, @delmaredigital/experiments-stats, is installed as a dependency of the plugin.
Requirements
- Node.js
>=22.23.4. - Next.js App Router. The plugin uses
proxy.ts, Server Components andafter(). - Postgres through
@payloadcms/db-postgres, with transactions enabled. Other database adapters are not supported: deduplication, locks and aggregation use SQL that Payload's Local API cannot express.
Peer dependencies
Install the peers your app uses:
| Peer | Version |
|---|---|
payload, @payloadcms/db-postgres, @payloadcms/next, @payloadcms/ui | >=3.90.0 <4 |
next | >=16.4.1 <17 |
react, react-dom | >=19.2.1 <20 |
pg | >=8.13.0 <9 |
@puckeditor/core (optional) | >=0.24.0 |
Puck is optional. If you use the Puck integration, it works with @delmaredigital/payload-puck >=0.10.3.
Environment
Keep your Payload secret and database connection, and add secrets for experiment signing and your results route:
PAYLOAD_SECRET=replace-with-a-random-secret-at-least-32-characters
DATABASE_URI=postgresql://postgres:postgres@localhost:5432/my-app
XP_SECRET=replace-with-a-separate-random-private-value
CRON_SECRET=replace-with-another-random-private-valueXP_SECRET signs the visitor cookie, the assignment and request headers, and preview tokens. Keep it the same across deployments and instances. Replacing it without retaining the old secret gives every visitor who has given consent a new visitor identity on their next visit; visitors without consent receive no visitor identity. To rotate it while preserving identities, pass an array with the newest secret first (see Runtimes).
Entry points
The package has separate entry points so the proxy stays free of Payload, React and Puck:
| Import | Use it in |
|---|---|
@delmaredigital/payload-experiments | payload.config.ts and collection configs |
@delmaredigital/payload-experiments/runtime/proxy | The proxy runtime module |
@delmaredigital/payload-experiments/runtime/server | The server runtime module |
@delmaredigital/payload-experiments/proxy | proxy.ts |
@delmaredigital/payload-experiments/rsc | Server Components, route handlers, server actions |
@delmaredigital/payload-experiments/client | Client components |
@delmaredigital/payload-experiments/puck, /puck/editor | Puck render and editor configs |
The full list is in Entry points.
Next step
Follow the Quick start to wire the runtimes, the plugin, the proxy and a results route.

