On this page
  1. Install
  2. Install and compose a schema
  3. Transform options
  4. Resolve injected collections
  5. Boundary
  6. API entry points and requirements
  7. Peer dependencies

@playstack/content

Framework- and loader-independent content transforms, schema fields, and array resolution helpers.

Pro. Covered by the Playstack Pro License. Registry access is required; check preview availability before installing. See package access.

@playstack/content contains pure, deterministic content transforms, shared schema fields, and array-resolution helpers that work with Content Collections or any other loader.

Install

After confirming preview access, install the package at your application's shared Playstack version:

sh
npm install --save-exact @playstack/content@0.1.0-beta.1

Check the peer requirements below before choosing a runtime or provider.

Install and compose a schema

ts
import { contentBase } from '@playstack/content/zod'
import { excerpt, normalizeDate, readingTime, slugify } from '@playstack/content'
import { z } from 'zod'

const postSchema = z.object({
  ...contentBase,
  content: z.string(),
  tags: z.array(z.string()).default([]),
})

const post = postSchema.parse(input)
const slug = post.slug ?? slugify(post.title)
const date = normalizeDate(post.date)
const summary = excerpt(post.content, { words: 40 })
const duration = readingTime(post.content, { wordsPerMinute: 220 })

contentBase defines title, description, flexible input date, published flag, and optional slug. Applications extend it rather than inheriting a loader-specific document type.

Transform options

FunctionOptionsResult
slugifyseparator: '-' | '_'Unicode-normalized, stable lowercase slug.
readingTimewordsPerMinute, excludeCodeBlocksWord count, fractional minutes, and display text.
extractTocminDepth, maxDepthNested heading items.
excerptwords, markerWord-bounded plain-text excerpt.
normalizeDateNoneValid normalized ISO timestamp.

Resolve injected collections

ts
import {
  resolveAdjacent,
  resolveDoc,
  resolveDocs,
  resolvePaths,
  resolveRelated,
} from '@playstack/content'

const post = resolveDoc(allPosts, { slug: 'build-once' })
const published = resolveDocs(allPosts, {
  filter: (entry) => entry.published,
  sort: (a, b) => b.date.localeCompare(a.date),
  limit: 20,
})
const paths = resolvePaths(allPosts, { param: 'slug' })
const adjacent = resolveAdjacent(allPosts, { slug: 'build-once' })
const related = resolveRelated(allPosts, { slug: 'build-once', by: 'tags', limit: 3 })

Resolution accepts document arrays and optional nested fields.slug/fields.date mappings. Filtering, sorting, limits, related-field selection, and route param names stay explicit application inputs.

Boundary

The package performs no filesystem or network access and depends on no framework, rendering library, or content loader. It does not compile Markdown, render MDX, watch files, or own pagination UI. Consumers inject already-loaded values, making the helpers usable at build time, runtime, and in tests.

API entry points and requirements

Reference snapshot: @playstack/content@0.1.0-beta.1. Import only the entry point your runtime needs. Paths below are relative to the installed package; use Go to Definition in your editor to inspect exact parameters, return types and overloads. Do not import the declaration-file paths directly.

Public entry pointDeclaration file
@playstack/content./dist/index.d.ts
@playstack/content/zod./dist/zod.d.ts
@playstack/content/package.jsonNo TypeScript declaration (asset or metadata export).

Node.js engine requirement: >=20. This is not a claim that every entry point works in browsers or Workers.

Peer dependencies

Keep existing framework versions that satisfy these ranges. Install optional peers only when using the corresponding adapter. The package manager resolves ordinary dependencies separately.

PeerCompatible rangeWhen needed
zod^4.4.3Optional; only for the entry points that use it.

For a complete first program, start with Getting started. For API lookup and partial-example conventions, see Reading the reference. Provider failures, lifecycle requirements and application responsibilities remain described in the guide above; types alone do not establish production safety.

Go

Playstack Pro tag
OriginsPricingBlogNewsletterChangelogStatusRoadmap
ContributorsCommunityIn Use ShowcaseCase StudiesPartnersSponsors
FAQsSupportContact

© 2026 Playstack. All rights reserved.

With OSS
Terms of ServicePrivacy PolicyCookie PolicyImprint

By

Commune Software