@playstack/feeds-next
Next.js App Router request handlers for Playstack feeds using Web platform primitives.
Pro. Covered by the Playstack Pro License. Registry access is required; check preview availability before installing. See package access.
@playstack/feeds-next exposes generated or inline feed documents through Next.js App Router-compatible handlers using only Web Request, Response, and stream APIs.
Install
After confirming preview access, install the package at your application's shared Playstack version:
npm install --save-exact @playstack/feeds-next@0.1.0-beta.1Check the peer requirements below before choosing a runtime or provider.
Serve pre-generated documents
import { createGeneratedDocumentRoute } from '@playstack/feeds-next'
const route = createGeneratedDocumentRoute({
storage: feedsStorage,
namespace: 'marketing',
path: 'sitemap.xml',
mode: 'auto',
onError: (error) => errors.captureError(error),
})
export { route as GET, route as HEAD }| Generated route property | Purpose |
|---|---|
storage, namespace, path | Selects a committed generated document. |
mode | auto, proxy, or redirect. |
redirectAboveBytes | Overrides the core 5 MiB auto threshold. |
onError | Isolated storage/stream observer. |
path may be a resolver. pathFromParam(name, { prefix?, suffix? }) supports both direct and promised dynamic params used across Next versions while retaining core path validation.
Stream inline documents
import { createInlineFeedRoute } from '@playstack/feeds-next'
export const GET = createInlineFeedRoute({
format: 'rss',
definition: (request) => feedForHost(request.headers.get('host')),
entries: () => streamPublishedPosts(),
content: 'full',
cacheControl: 'public, max-age=60',
onError: reportStreamFailure,
})Inline feed options accept format, static or request-scoped definition, async entry source, full/excerpt mode, structured extensions, cache control, and error observer. createInlineSitemapRoute accepts the entry source, cache control, URL/byte ceilings, and observer. HEAD returns normal headers without invoking the entry source.
Error behavior
Traversal-like or missing dynamic paths return 400; missing manifests/documents return 404; retryable storage failures return 503 with Retry-After: 60; unsupported methods return 405; other pre-response failures return 500. After streaming begins, failures reject the body stream and reach onError because status and headers can no longer change.
Boundary
There is deliberately no next runtime or peer dependency. The application supplies generation, entries, storage, cache policy, and route placement; @playstack/feeds owns validation and serving semantics.
API entry points and requirements
Reference snapshot: @playstack/feeds-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/feeds-next | ./dist/index.d.ts |
@playstack/feeds-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/feeds | 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.