novinzodevelopers
Plugins

Storefront surfaces

Serve browser routes, Liquid data, theme blocks, and static assets through a store's domain.

Plugin Workers have no public URL. Novinzo dispatches storefront requests through the store's domain and requires an installed plugin.

Entry pointCallerWorker pathStore header and token
/plugins/<code>/storefront-public/...Browser or merchant server/storefront-public/**Yes
Liquid {% plugin %}Theme rendering/storefront/**Yes
Liquid {% plugin_block %}Theme rendering/theme/blocks/<id>@<version>.liquidYes
/plugins/<code>/assets/...Browser/assets/**No
Page injectionsEvery storefront pageNone: core stores the HTMLNo

These routes do not expose /admin, /webhooks, or /functions. See Admin screens for dashboard access.

Order-viewer routes use /plugins/<code>/orders/<orderId>/storefront-order/.... They require an authorized order viewer and carry an order-scoped invocation.

Use Core API for order-viewer endpoint requirements. A normal storefront invocation does not grant order-viewer access.

Public routes (/storefront-public)

The public forwarder accepts every HTTP method at /plugins/<code>/*. The remaining path must resolve within /storefront-public.

Novinzo decodes the plugin code. An invalid code returns 404 Not found before lookup.

Novinzo resolves the store from its subdomain or custom domain.

Novinzo pins the resolved path to /storefront-public. Plain and encoded traversal outside the surface returns 404.

Novinzo requires installation. Unknown and uninstalled plugins return the same 404 Not found.

Novinzo forwards allowed headers and attaches x-novinzo-store-id and x-novinzo-plugin-invocation.

Novinzo relays the response after applying redirect, header, and content-type restrictions.

For example, /plugins/acme/storefront-public/info reaches the Worker at /storefront-public/info. Query strings remain attached.

What your Worker receives

Caller headerPurpose
acceptContent negotiation
content-typeBody decoding
authorizationCredential addressed to your plugin, not shopper authentication
idempotency-keyCaller-defined request deduplication, when your route implements it

The forwarder attaches the domain-selected x-novinzo-store-id and signed x-novinzo-plugin-invocation. Caller-provided versions do not select a store.

Shopper cookies, origin, and other custom headers do not reach the plugin. Do not build plugin authentication around them.

Who the visitor is

When the visitor is signed in to the store and the store granted your plugin customers:read, the invocation also names the customer they are signed in as: Novinzo reads their session cookie before it forwards the request, and the cookie still never reaches your Worker. Without that grant the invocation names no customer, since a plugin can read what its token says. Ask Core API for that customer with GET /api/storefront/customer, which needs customers:read; it answers { "customer": null } for a guest.

Use it, for example, to sign an identity token a chat widget verifies, such as Intercom's intercom_user_jwt: your page script calls a /storefront-public route, and the route signs a token for the customer core names with a secret your Worker holds.

A visitor whose session could not be read is forwarded as a guest. Answers that depend on who the visitor is must not be cacheable; Novinzo keeps no edge copy of /storefront-public answers.

The signed invocation identifies the plugin and store for backend calls. Forward it unchanged to Core API.

Plugin authors receive no token-signing secret. Store access requires a current Novinzo invocation, not a cron or background call.

State-changing browser requests must come from the store's own origin. Novinzo returns 403 Origin not allowed for a foreign Origin or foreign Sec-Fetch-Site.

GET, HEAD, and OPTIONS bypass this origin guard. Server clients without either browser-origin header pass it, but still need your route's authentication.

What your Worker can answer

Novinzo relays status, body, and permitted response headers. Set a usable content-type for every response body.

Public and order-viewer routes reject HTML, XML, XSL, multipart document streams, and all +xml media types with 502.

Missing or malformed content types also return 502 for nonempty responses. Empty responses bypass media-type filtering.

Novinzo adds x-content-type-options: nosniff to accepted responses.

These response headers are removed:

set-cookie
clear-site-data
service-worker-allowed
www-authenticate
strict-transport-security
nel
report-to
reporting-endpoints
content-security-policy-report-only
access-control-allow-origin
access-control-allow-credentials

Statuses 301, 302, 303, 307, and 308 return 502 Plugin <code> answered with a redirect instead.

Redirects otherwise risk replaying a caller's bearer token to another destination. Return JSON that your browser code handles instead.

No sessions, no redirects

The plugin cannot set store-origin cookies or redirect a public API request. Keep tenant data scoped to the platform-selected store.

Rate limiting

Public and order-viewer routes share the cart budget: 60 requests per 60 seconds per client IP and store host.

Cart synchronization consumes the same budget. Exceeding it returns 429 before the Worker runs.

The public forwarder streams request and response bodies. It does not apply the admin screen's 1 MiB request or 5 MiB response limits.

The public forwarder defines no separate fixed request timeout. Bound expensive work and uploads in your own API instead of assuming an unlimited platform lifetime.

Declaring the routes

The following standalone Worker publishes a plugin information card. Its data is public, tenant-independent content, not private store data.

It implements browser JSON, Liquid JSON, and static files. Register the code acme and coordinate dispatch deployment with Novinzo.

worker.js
const info = { title: "Acme help", message: "Contact this store for product support." };

export default {
  async fetch(request, env) {
    const path = new URL(request.url).pathname;
    if (path.startsWith("/assets/") || path.startsWith("/theme/blocks/")) {
      return env.ASSETS.fetch(request);
    }
    const browser = request.method === "GET" && path === "/storefront-public/info";
    const liquid = request.method === "POST" && path === "/storefront/info";
    if (browser || liquid) {
      if (
        !request.headers.get("x-novinzo-store-id") ||
        !request.headers.get("x-novinzo-plugin-invocation")
      ) {
        return Response.json({ error: "Missing platform invocation" }, { status: 401 });
      }
      return Response.json(info, { headers: { "cache-control": "no-store" } });
    }
    return new Response("Not found", { status: 404 });
  },
};

Header presence alone is not cryptographic authentication. This example relies on private dispatch and returns no sensitive data.

Backend store operations use the signed invocation, which Novinzo authenticates. See Security checklist before adding protected operations.

Building a browser client

Use a relative URL on the store's page. The store domain determines the tenant, not a body field or browser header.

<section id="acme-info" aria-live="polite"></section>
<script type="module">
  const target = document.getElementById("acme-info");
  try {
    const response = await fetch("/plugins/acme/storefront-public/info", {
      headers: { accept: "application/json" },
      credentials: "omit",
      signal: AbortSignal.timeout(10000),
    });
    if (response.status === 429) throw new Error("Too many requests. Try again later.");
    if (response.status === 404) throw new Error("This plugin is not available on this store.");
    if (!response.ok) throw new Error("Plugin request failed: HTTP " + response.status);
    const info = await response.json();
    if (typeof info.title !== "string" || typeof info.message !== "string") {
      throw new Error("Plugin returned an invalid information card.");
    }
    const title = document.createElement("h2");
    title.textContent = info.title;
    const message = document.createElement("p");
    message.textContent = info.message;
    target.replaceChildren(title, message);
  } catch (error) {
    target.textContent = error.message;
  }
</script>

The ten-second timeout belongs to this browser example, not the forwarder. The response uses text nodes instead of inserting plugin JSON as HTML.

Keep API access credentials out of public browser bundles. Merchant servers use the API access credentials flow.

Liquid data (/storefront)

Themes call the plugin during page rendering. In <code>.<path>, the first dot separates the plugin code from its route.

{% plugin "acme.info" as info %}
{% if info %}
  <h2>{{ info.title | escape }}</h2>
  <p>{{ info.message | escape }}</p>
{% endif %}

The call above sends POST /storefront/info with a JSON body. Named arguments become body fields. A call can ask for GET instead; see Cacheable calls.

{% plugin "categories.one", slug: "summer-sale" as result %}
{% if result %}
  <h2>{{ result.category.name | escape }}</h2>
{% endif %}

A body: argument that evaluates to an object merges with named arguments. Non-object bodies are dropped.

The names plugin, path, route, method, and body are reserved rather than ordinary payload fields.

Explicit plugin:, path:, or route: arguments select the destination. method: "GET" sends a GET; any other method: value still sends POST.

Novinzo attaches content-type: application/json, the domain-selected store header, and its invocation token. Template-controlled fields never select the store.

Novinzo resolves the path and rejects plain or encoded traversal outside /storefront. Calls require an installed plugin.

Only a 2xx response containing valid JSON becomes template data. Failed calls bind nil, and the rest of the page renders.

Guard calls with {% if %}. The full invocation, including response reading, has a five-second timeout and a 1 MiB response limit.

Return JSON on success

Non-2xx responses are failures even when their bodies contain JSON. Return a 2xx body matching the template's expected shape.

Treat every template argument as untrusted input. The store header describes the current invocation, not any storeId supplied by the template.

See Liquid for template syntax.

Cacheable calls

With method: "GET", Novinzo sends the arguments as the query string instead of a JSON body. Only string, number and boolean values fit a query parameter; any other value fails the call, which binds nil.

{% plugin "acme.info", method: "GET", slug: "summer-sale" as info %}

A GET also carries _nz_store and _nz_generation in its query: the store id and the store's current content generation. Workers Cache keys responses by URL, so a response cached under them is never served to another store, and an announced content change starts a new key without a purge. Novinzo sets both parameters itself, replacing any argument with the same name.

If your Worker has Workers Cache enabled, answer Cache-Control with a lifetime only when _nz_store equals the x-novinzo-store-id header, and no-store otherwise. A 200 with no Cache-Control is otherwise kept for two hours under a key that may name no store.

Theme blocks ({% plugin_block %})

A theme block is a versioned Liquid fragment.

{% plugin_block "acme/info@1", heading: "Product support" %}

The reference is <code>/<blockId>@<version>. Versions are integers starting at one.

Novinzo sends GET /theme/blocks/info@1.liquid with the store header and invocation token. The store must have installed the plugin.

Arguments become props inside the block. Block-local assignments do not leak into the surrounding template.

OutcomeRendered result
2xx and successful compilationBlock content
4xx, uninstalled plugin, or undeployed pluginNothing
5xx, compilation error, or transport failureFailure notice for this render

Successful compilation and absent blocks are cached within the current page request. Operational failures do not become cached absence.

Checkout pages render blocks more narrowly than the store's other pages:

PageBlocks rendered
The cart's checkout (/checkout)Those templates/checkout.liquid itself names
A prepared checkout's pay page, a renewal's pay page, the cancellation pageNone
Every other page the theme rendersEvery block the theme names, wherever it is

On /checkout, a block that only a layout, section or snippet names renders nothing, so a block the theme shares with the rest of the store does not follow the buyer to the page that starts their payment. A theme author who wants a block there places it in the checkout template. Blocks are matched by name: once the checkout template names a block, a layout, section or snippet that names the same block renders it too. The pay pages of a prepared checkout and of a renewal render that same template without its blocks.

A block that asks the buyer something belongs inside <nz-checkout-form>. The form shows what the template writes inside it in its card, after its own fields and before the payment methods, and disables those controls while a payment is under way. Style such a block as the card's fields are, with no surface of its own; a block placed outside the form renders where the template put it.

The compile cache does not persist across page requests or stores. Do not depend on a cross-request block cache.

public/theme/blocks/info@1.liquid
{% plugin "acme.info" as info %}
{% if info %}
  <acme-info>
    <h2>{{ props.heading | default: info.title | escape }}</h2>
    <p>{{ info.message | escape }}</p>
  </acme-info>
  <script type="module" src="/plugins/acme/assets/info.v1.js"></script>
{% endif %}
public/assets/info.v1.js
class AcmeInfo extends HTMLElement {
  connectedCallback() {
    if (this.querySelector("button")) return;
    const button = document.createElement("button");
    button.type = "button";
    button.textContent = "Print support information";
    button.addEventListener("click", () => window.print());
    this.append(button);
  }
}
if (!customElements.get("acme-info")) customElements.define("acme-info", AcmeInfo);

Name the custom elements in your blocks with your own prefix, such as acme-. The nz- prefix is reserved for Novinzo's storefront elements, and theme deploys refuse nz- elements the storefront does not serve. Blocks are not part of a theme bundle, so that check does not read them. Avoid the prefix anyway: a later storefront element can take the same name.

Published versions are immutable

Keep info@1.liquid and its versioned assets unchanged. Publish info@2.liquid and new asset filenames for changes. Themes opt into the new version.

Page injections

A plugin granted storefront:inject adds its own HTML to every page of the store's storefront, without the theme naming it: a chat widget, an analytics or pixel tag, an announcement bar, a popup or a maintenance overlay. The plugin sets one injection per store through core-for-plugins' storefront injection endpoints: a head snippet, placed right before each page's </head>, a body snippet, placed right before its </body>, and the https: origins its scripts, connections, stylesheets, fonts, images and frames come from, which those pages' Content Security Policy then admits.

PageGets the injections
Home, product, policy, login, theme route and 404 pagesYes
Checkout pages (/checkout, /checkout/...)No
Order pages (/orders, /orders/...)No
Subscription renewal pay pages (/subscriptions/renew/...)No
Pages your plugin serves (/plugins/<code>/...)No
Theme previewsNo

Novinzo places every plugin's snippets in plugin code order, as given and unescaped. A page with no </head> in its first 64 KB gets the head snippets with the body ones, before its last </body>. A page with no </body> gets the body snippets at its end, with the head ones when it had no </head> in its first 64 KB either.

The markup is trusted as a theme block is: it runs on the store's own origin with the visitor's cookies, as the theme does, so a seller grants storefront:inject only to a plugin they trust with their storefront. Checkout, order and renewal pay pages never carry it, so no plugin reaches a payment form, a payment's return or the keys an order delivered through an injection. A plugin's markup is on one of those pages only where the theme's author placed its theme block.

Each page admits the declared origins in its Content Security Policy, each list under one directive. These are the only directives a plugin can extend:

FieldDirectiveOrigins
scriptOriginsscript-srchttps:
connectOriginsconnect-srchttps: or wss:
styleOriginsstyle-srchttps:
fontOriginsfont-srchttps:
imgOriginsimg-srchttps:
frameOriginsframe-srchttps:

Only scriptOrigins and connectOrigins are required; leave out the others to declare none. img-src already admits every https: image, and style-src inline styles.

Every other directive stays as Novinzo sets it: default-src 'self' covers what the table does not, such as media-src, and pages still refuse to be framed. script-src has no 'unsafe-inline': load your code from a declared origin or from your plugin's static assets, which are on the store's origin, rather than inline <script> blocks.

Storefront pages are cached under the store's content generation. Setting or clearing an injection announces the change, and so do uninstalling the plugin, the seller changing its grants and a store-private plugin deployment that stops asking for storefront:inject, so pages show the change without waiting for the cache. A page rendered while the injections cannot be read is served without them and cached nowhere.

Static assets (/assets)

GET /plugins/<code>/assets/<file> reaches /assets/<file> on the Worker. Novinzo streams the response through the store origin.

The store origin keeps an edge copy of each 200 response of an accepted type, per store host, plugin, asset path and query string. How long depends on the URL's v query parameter:

URLAnswered and kept
No v, and your Cache-Control declares immutable with a max-ageWith your Cache-Control, kept for its max-age
No v, any other Cache-ControlWith your Cache-Control, kept for five minutes
v is the start of the SHA-256 of the bytes, in hex, at least 12 charactersAs public, max-age=31536000, immutable, kept for a year
Any other vAs public, max-age=300, kept for five minutes

Novinzo checks a v against the bytes because your static headers match a path, not a query, and a deployment runs two versions of your Worker side by side: neither proves which bytes a v came with. Bodies over 2 MiB are not checked, so their v URLs get five minutes. A versioned filename with an immutable Cache-Control, as in the block example, needs no v. Edge copies are served without a new install check, so an asset can still load on a store for up to its period after the store uninstalls the plugin.

Assets are tenant-independent, but access still requires a recognized store domain and an installed plugin.

  • Unknown domains, unknown plugins, and uninstalled plugins return 404 without publishing plugin bytes on that origin, once any edge copy has expired.
  • Store or installation lookup failures return 503. A rate-limited backend lookup returns 429 with Retry-After.
  • Requests contain no store header or invocation token. Never return tenant data from assets.
  • Only accept, accept-encoding, if-modified-since, if-none-match, if-range, and range survive forwarding.
  • Static asset redirects are relayed. Transport failures return 502.

The proxy accepts scripts, styles, JSON, manifests, WebAssembly, plain text, binary data, standard raster images, SVG, and standard font types.

It rejects HTML and other unsupported types. Accepted SVG responses receive content-security-policy: sandbox, and accepted assets receive x-content-type-options: nosniff.

The blocked response headers listed above also apply to assets. cache-control, etag, last-modified, and range headers remain available.

Serve files with Workers Static Assets. This configuration belongs to your standalone project.

wrangler.jsonc
{
  "name": "acme-plugin",
  "main": "worker.js",
  "compatibility_date": "2026-10-01",
  "workers_dev": false,
  "preview_urls": false,
  "assets": {
    "directory": "./public",
    "binding": "ASSETS",
    "run_worker_first": true,
  },
}

run_worker_first sends requests through your Worker before the asset binding. Keep its fallback response outside the two supported static roots.

worker.js
wrangler.jsonc
_headers
info.v1.js
info@1.liquid

Set immutable caching only on versioned resources whose bytes never change.

public/_headers
/assets/info.v1.js
  Cache-Control: public, max-age=31536000, immutable
/theme/blocks/info@1.liquid
  Content-Type: text/plain; charset=utf-8
  Cache-Control: public, max-age=31536000, immutable

The asset binding handles HTTP revalidation and range responses. These headers do not add a cross-request Liquid compilation cache.

Install Wrangler with npm install --save-dev wrangler. Coordinate asset deployment, plugin registration, and production dispatch with Novinzo through Deployment.

Next steps

On this page