Skip to content

Server package API

Import: @mauriciodmo/framekit/server
Environment: server-only Node.js.

The server entrypoint exports the unified createFrameKitApiHandler, access and image handlers, render helpers, private render-page handoff, image-input preparation, render-job helpers, and their public request, error, token, and job types.

Mount the unified handler from a server-side Next.js catch-all route:

import { createFrameKitApiHandler } from '@mauriciodmo/framekit/server'
import { templates } from '@framekit/generated/templates'
export const runtime = 'nodejs'
export const dynamic = 'force-dynamic'
const handler = createFrameKitApiHandler(templates)
export const GET = handler
export const POST = handler
export const PATCH = handler
export const DELETE = handler

The unified handler serves access operations when FRAMEKIT_AUTH_ENABLED=true and POST /api/framekit/images/render in both modes. In open mode, image requests need no credential and access operations are absent. createRenderPage is the separate private page handoff used by the server-side PNG renderer.

This entrypoint is server-only and must not be bundled for browsers or deployed to an Edge runtime. Keep any credentials, sessions, API tokens, and render configuration on the server. The renderer requires the explicitly installed Chromium headless shell; it is intended for a long-lived Node.js process.

See HTTP API, image render API, existing-project integration, and the development API.