PagieraDocs
API and documents

API reference

Server, client and package exports in one place.

Entry points

ImportPurpose
pagieracreateDocument, createPagieraClient, lightweight editor, panel URL helpers
pagiera/fullPagieraStudio and its props/adapters contract
pagiera/providerPagieraProvider and host font registration
pagiera/serverServer configuration, route handlers and database-backed loading
pagiera/runtimeRenderedPage and loadPageData
pagiera/dataData rendering helpers
pagiera/full.css / pagiera/styles.cssFull studio / lightweight editor styles

Server imports require a Node.js server environment and must not enter a client bundle.

Server loader

pagieraConfigFromEnv(env?) reads server configuration. createPagieraRouteHandlers(config) returns GET, POST, PUT, PATCH and DELETE handlers; initialization is lazy. getPagieraServer(config) returns a reused server instance. createPagieraServer(config) explicitly creates one; call close() when the owner disposes it, not after each ordinary request.

Server methodResult
getEditorBootstrap(pageId?)Current page, page list and document library, or undefined
getPublishedDocument(slug)Published document and matched route pattern/parameters, without fetching page data
getPublishedPage(slug, context?)Published document plus server-resolved data, or undefined
getPreviewPage(pageId, context?)Draft plus fresh source data, or undefined
handle(request)Backend HTTP response; the host must authorize access
close()Close owned Redis/PostgreSQL resources

HTTP surface

Paths below are relative to /api/pagiera. The host controls authentication and role checks for every endpoint.

MethodPathPurpose
GET/healthHealth after server initialization
GET/bootstrap?pageId=…Studio bootstrap
POST/pagesCreate a page; list pages through /bootstrap
GET / PATCH / DELETE/pages/:idRead / rename / delete
POST/pages/:id/saveSave { document, expectedVersion }
POST/pages/:id/duplicateDuplicate with name and slug
POST/pages/:id/publish / unpublishChange public state
GET/pages/:id/revisionsList saved revisions
POST/pages/:id/revisions/:revisionId/restoreRestore a draft revision
POST / GET/assets / /assets/:idRaw raster upload / media delivery
POST/data/previewPreview a source and sample query
POST/aiAI generation; NDJSON progress when streamed
POST/mcpAuthorized list/inspect discovery
GET/templates/registry.jsonConfigured registry
POST/templates/install / importInstall by ID / import a bundle
GET/templates/export?id=…Export a page template

Browser client and adapters

import { createPagieraClient } from "pagiera";
const client = createPagieraClient({ baseUrl: "/api/pagiera" });
const page = await client.loadPage("PAGE_ID");
const result = await client.adapters.save(page.id, {
  elements: page.elements,
  rootStyle: page.rootStyle,
  dataSources: page.dataSources,
}, page.version);
if (result.status === "conflict") {
  // Reload and reconcile; never overwrite a newer page blindly.
} else if (result.status === "error") {
  throw new Error(result.message);
}

Supply a custom fetch to createPagieraClient when your host needs extra request handling. Save can return saved, conflict or error in a successful HTTP response. Other HTTP failures throw; inspect the status and response before retrying.

Studio adapters include page CRUD, publishing, revisions, source preview, image upload, generation and template operations. Host callbacks such as navigate, editorHref, previewHref, publishedHref, refresh and saveTranslation are supplied by your application. See the complete setup.

Assets and trust

uploadImage(file) sends raw bytes, not multipart form data. The server accepts PNG, JPEG, WebP, GIF and AVIF, checks image signatures and limits each asset to 8 MB. It returns a short URL. Base64 raster images reaching saves/imports are externalized; identical bytes deduplicate. This is separate from visitor FileInput submissions.

A document's data-source headers are readable by authorized editors; they are not a secret vault. Keep service credentials in host code. See security and deployment configuration.

On this page