@playstack/content-next
Explicit Next.js Pages and App Router helpers for resolving portable content collections.
Pro. Covered by the Playstack Pro License. Registry access is required; check preview availability before installing. See package access.
@playstack/content-next connects application-loaded documents to explicit Pages and App Router boundaries. It imports no Next.js runtime and works with Content Collections, a CMS, or any other source that produces document values.
Install
After confirming preview access, install the package at your application's shared Playstack version:
npm install --save-exact @playstack/content-next@0.1.0-beta.1Check the peer requirements below before choosing a runtime or provider.
App Router
import { notFound } from 'next/navigation'
import { documentFor, staticParamsFor } from '@playstack/content-next/app'
export const generateStaticParams = () => staticParamsFor(allPosts, { param: 'slug' })
export default async function PostPage({ params }) {
const post = await documentFor(allPosts, { params, param: 'slug' })
if (!post) notFound()
return <Post document={post} />
}documentFor() accepts direct or promised params, returns null for absent, catch-all, or unknown slugs, and supports the portable package's field mappings. Next.js redirects, draft mode, cache policy, and notFound() remain application-owned.
Pages Router
import { staticPathsFor, staticPropsFor } from '@playstack/content-next/pages'
export const getStaticPaths = () => staticPathsFor(allPosts, { param: 'slug' })
export const getStaticProps = staticPropsFor(allPosts, {
param: 'slug',
})serverSidePropsFor() provides request-time resolution. Missing documents become notFound by default or an explicit non-permanent redirect. A select(document, context) callback can project custom serializable props.
Configuration and boundary
| Surface | Responsibility |
|---|---|
documentFor | Resolve one App Router document from direct or promised params. |
staticParamsFor | Produce generateStaticParams records. |
staticPathsFor | Produce Pages Router static paths. |
staticPropsFor | Resolve static props with missing-document behavior and optional projection. |
serverSidePropsFor | Resolve request-time props using the same content mapping. |
The package root exposes uniquely named helpers from both routers, but router-specific entrypoints are recommended so the application boundary remains visible. Content loading, authorization, rendering, and framework cache semantics stay outside the adapter.
API entry points and requirements
Reference snapshot: @playstack/content-next@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 point | Declaration file |
|---|---|
@playstack/content-next | ./dist/index.d.ts |
@playstack/content-next/app | ./dist/app.d.ts |
@playstack/content-next/pages | ./dist/pages.d.ts |
@playstack/content-next/package.json | No 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.
| Peer | Compatible range | When needed |
|---|---|---|
@playstack/content | 0.1.0-beta.1 | Required by the package. |
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.