OOlgax DXP
Reference

@olgax.com/payload-preset

Reference for @olgax.com/payload-preset - the Payload CMS collections and globals behind Olgax DXP - users, media, pages, sections, page views, webhooks and site settings.

Reusable Payload collections and globals for an Olgax DXP site. Every one defines explicit access control.

pnpm add @olgax.com/payload-preset

Usage

payload.config.ts
import { buildConfig } from "payload";
import {
  Users,
  Media,
  Pages,
  Sections,
  PageViews,
  Webhooks,
  SiteSettings,
} from "@olgax.com/payload-preset";

export default buildConfig({
  collections: [Users, Media, Pages, Sections, PageViews, Webhooks],
  globals: [SiteSettings],
  // ...db, editor, secret, localization
});

A scaffolded site already has this wired up.

Collections

users

Payload auth collection, titled by email. The first user can be created without signing in, which is how the first admin is bootstrapped. After that, creating and reading users requires a signed-in user.

media

Upload collection with a required alt text field. Publicly readable. Create, update and delete require a signed-in user.

pages

FieldTypeNotes
titletext, requiredLocalized
slugtext, requiredUnique and indexed
datajson, requiredLocalized. Puck's Data object.
  • Payload drafts are enabled (versions.drafts). See Drafts and publishing.
  • Signed-in users read everything. Anonymous users read published pages only.
  • Dispatches page.published and page.deleted webhooks.
  • Adds a Quick links panel in the admin sidebar.

sections

FieldTypeNotes
nametext, requiredAlso the admin title
contentjson, requiredLocalized. An array of Puck component data (Data.content), not a full Data object.

Reusable groups of blocks, used with start from section when creating a page. A locale without a translation falls back to the default locale. All access requires a signed-in user.

page-views

FieldTypeNotes
slugtext, requiredIndexed
localetext, required
datedate, requiredDay-level
countnumberRead-only in the admin

A unique index on slug, locale and date keeps one row per page, language and day. Written by the server on public page loads. See Analytics.

webhooks

FieldNotes
nameA label
urlReceiver URL
secretUsed to sign requests with HMAC-SHA256
eventspage.published, page.deleted
enabledToggle without deleting

See Webhooks.

Globals

site-settings

FieldNotes
localizationEnabledCheckbox, default on. Locale-prefixed URLs on, or the default locale at bare URLs off.
primaryColorHex color. Blank keeps the default.
backgroundColorHex color. Blank keeps the default.
textColorHex color. Blank keeps the default.

Color values are validated as hex (#rgb, #rgba, #rrggbb or #rrggbbaa). Readable by everyone, updatable by signed-in users.

Extending

Treat these as a starting point. Add your own collections alongside them, or add fields to a copy of one. When you change the schema of a database with real data, create a migration.

Questions, ideas or something not working?

Ask in our official Discord, open an issue on GitHub, or edit this page.

On this page