novinzodevelopers
Plugins

Your own plugins

Build a plugin for your own store in your own repository, and deploy it to Novinzo from your terminal or CI.

A store owner can build a plugin for their own store and run it on Novinzo without coordinating with Novinzo. A store-private plugin uses the same contracts as every other plugin: the same webhooks, admin screens, platform calls and permissions. The differences are who can install it, who hosts it, and where it is defined.

  • Its source is its only definition. Its code, its D1 migrations and novinzo.plugin.json, which says what the plugin is, live in your repository, or in a source Novinzo hosts. Each deployment carries them, and only a deployment changes what the plugin is.
  • Only your store can install it. To every other store its code is unknown, even to stores you also own.
  • Novinzo hosts its Worker. You deploy a build from GitHub Actions, with a deploy token from anywhere else, or from its hosted source. You never need a Cloudflare account.

Only the store's owner can create, deploy, install or delete a store-private plugin. Team members can use its admin screens once it is installed.

Set it up

Reserve the plugin

In the dashboard, open Settings, then Apps, and create a plugin under Your plugins, giving it a name of up to 60 characters. Novinzo gives it a code, such as p-3bcd5278f994, that never changes and is never reused. Use it wherever a code names the plugin: /plugins/<code>/ URLs and {% plugin %} tags.

A store can have up to 10 store-private plugins at once. Until its first deployment, a plugin asks for nothing, serves nothing and goes by the name you gave it. From then on, the name in its novinzo.plugin.json names it.

Declare it in novinzo.plugin.json

Build the Worker as in the quickstart, then add novinzo.plugin.json beside its wrangler.jsonc:

novinzo.plugin.json
{
  "name": "Loyalty points",
  "permissions": ["orders:read"],
  "webhooks": ["variant-purchased", "variant-refunded"],
  "hasAdminScreens": true,
  "sidebarGroup": "sales"
}
FieldDefaultMeaning
name—Shown in the dashboard, up to 60 characters. Required.
permissions[]The permissions it asks for. Asking grants nothing: you grant them when you install.
webhooks[]The webhooks it receives: variant-purchased, variant-refunded, order-refunded, payment-disputed, payment-fraud-warned, variant-deleted, variant-stock-changed, subscription-started, subscription-renewed, subscription-past-due, subscription-ended, checkout-completed, checkout-cancelled, checkout-expired, hourly-tick, seller-action; admit-checkout, to be asked AdmitCheckout before each buyer pays; and extend-order-email and render-order-email, to be asked ExtendOrderEmail and RenderOrderEmail.
hasAdminScreensfalseIt serves an admin screen at GET /admin/ui.
adminReadPaths[]Admin API paths whose POST only reads; the store's analysts reach them. See Admin screens.
adminSections[]Sections of your screens the owner can grant a teammate one by one: { id, label, paths, scope? }.
adminSlots[]Admin slots, product, product-variant, product-variant-delivery, overview, order and customer, that also show its screen. They need hasAdminScreens.
sidebarGroupnullThe dashboard sidebar group, general, sales or store, that lists its page while it is installed. It needs hasAdminScreens and @emergente-labs/plugin-cli 0.1.1 or later, since 0.1.0 drops it. Without one, it is opened from Settings > Apps.
usesApiAccessCredentialsfalseYou issue API keys for its storefront public routes and admin API.

webhooks can also list quote-payment-surcharges, which needs @emergente-labs/plugin-cli 0.1.4 or later. Novinzo then asks the installed plugin what paying with each of the store's payment methods adds to a checkout and charges the buyer its answer. While the plugin cannot answer, checkout is refused. See QuotePaymentSurcharges.

With extend-order-email, the plugin can only ask for a blind copy of the buyer's order confirmation email, which Novinzo sends when you grant the plugin orders:read. Novinzo shows none of the sections it answers: changing what the email says needs a store's own sending domain, from which render-order-email writes the whole email. See ExtendOrderEmail.

@emergente-labs/plugin-cli refuses a manifest value it does not know, so these need 0.1.5 or later: the webhooks order-refunded, payment-disputed, variant-stock-changed, hourly-tick, seller-action, admit-checkout, extend-order-email and render-order-email; the permissions orders:list, orders:annotate, customers:list, emails:customize and storefront:inject; and the admin slots order and customer.

webhooks can also list sync-search-records, which needs @emergente-labs/plugin-cli 0.1.6 or later. Novinzo then asks the plugin, through SyncSearchRecords, for the records it makes searchable in the dashboard, page by page, when it is installed and after each deployment.

permissions can also list prices:adjust and products:deliver, which need @emergente-labs/plugin-cli 0.2.1 or later. A plugin that calls UpdatePlan needs prices:adjust, and one that calls a product delivery endpoint needs products:deliver. Novinzo does not require them yet; a coming release refuses those calls to a plugin its store has not granted the permission. Add it to the manifest, deploy, and grant it on the plugin's page before then.

permissions can also list payments:read, which needs @emergente-labs/plugin-cli 0.2.1 or later. A plugin that calls the payment connections endpoint needs it.

permissions can also list keys:issue, which needs a release of @emergente-labs/plugin-cli after 0.2.1. A plugin that calls VariantKeysIssue needs it.

permissions can also list push:send, which needs a release of @emergente-labs/plugin-cli after 0.2.1. A plugin that calls SellerOrderPushSend needs it.

The webhooks subscription-started, subscription-renewed, subscription-past-due and subscription-ended need @emergente-labs/plugin-cli 0.2.1 or later.

Store-private plugins cannot serve partner screens, which reach accounts outside your store.

On the plugin's page, link the GitHub repository and branch it deploys from, such as acme/loyalty-plugin on main. A GitHub Actions run of that repository and branch can then deploy the plugin. GitHub gives each run an identity token that says which repository, branch and commit it runs, so your repository holds no secret, and there is nothing to copy or rotate. Only runs started by push, workflow_dispatch or schedule can deploy; runs for pull requests and other events are refused, so a workflow never deploys code from a fork.

The first run from it deploys nothing. It fails with a message asking the owner to approve the repository, and the plugin's page shows it under A run is waiting for approval, with the GitHub user who started it, the repository and the commit. When you recognize it, choose Approve, then re-run the job. From then on, every run of the linked branch deploys the plugin.

A repository name alone does not prove who holds the repository: a typo, a name freed by a rename, or a repository you have not created yet could let someone else's repository match the link. Approval pins GitHub's numeric repository and owner IDs from the run you approved. After that, renaming the repository keeps it linked, and a new repository that takes its old name cannot deploy. Link it again to deploy from a different branch, and it stays approved. Linking a different repository needs a new approval.

Deploy on every push

Add this workflow, with your plugin's code in NOVINZO_PLUGIN. The plugin's page shows it filled in.

.github/workflows/novinzo-deploy.yml
name: Deploy to Novinzo

on:
  push:
    branches: ["main"]

permissions:
  contents: read
  id-token: write

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: 22
      - run: npm ci
      - run: npx @emergente-labs/plugin-cli deploy
        env:
          NOVINZO_PLUGIN: p-3bcd5278f994

id-token: write lets the job ask GitHub for its identity token. The CLI checks novinzo.plugin.json, builds the Worker with wrangler deploy --dry-run, reads the DB binding's migrations and deploys them all. A deployment from GitHub Actions records the repository, branch and commit GitHub vouched for. npx @emergente-labs/plugin-cli deployments lists the last 20 deployments, as does the plugin's page.

Install it

A new plugin is not installed. Install it from its page and choose which of the permissions it asks for to grant. Until it is installed, Novinzo sends it nothing and the platform refuses its calls. Installing, changing access and uninstalling work as for any plugin; see Registration, installs and permissions.

Preview before you deploy

To try a change on your store before buyers get it, run dev from the plugin's directory with a deploy token. It needs @emergente-labs/plugin-cli 0.2.1 or later:

NOVINZO_DEPLOY_TOKEN=novinzo_deploy_… npx @emergente-labs/plugin-cli dev

It builds the plugin as deploy does and uploads it as the plugin's preview, a second Worker beside the live one, then uploads it again whenever a file in the project changes. On the plugin's page, under Preview, open it in your admin screen, which shows the preview in that browser tab alone (a tab you open from it shows the live plugin) until you go back to the live plugin, or on your storefront, through a link that works once and only for you. Pages there say you are previewing, with a way out.

  • Only your browser sees the preview, and only as the store's owner. Team members, buyers, webhooks, functions and payments keep the live plugin.
  • On the storefront, the preview answers the plugin's /plugins/<code>/ API routes. Its assets, blocks and page injections stay the live deployment's: deploy to change those.
  • The preview runs on the live plugin's database and with the access you granted it, so what it writes is real. It runs no migrations: deploy to add one, then preview again. A migration the live plugin already ran must stay exactly as it ran. It has none of the live Worker's secrets.
  • What the plugin is (its novinzo.plugin.json) stays the live deployment's.
  • It stops a day after its last upload, when you stop it on the plugin's page, or when the plugin is deleted.

Deploy from anywhere else

To deploy from your terminal or another CI, issue a deploy token on the plugin's page, with a label such as "Laptop" and a lifetime of up to a year. Novinzo shows it once. It deploys this plugin and nothing else: it cannot install the plugin, grant it anything, or list or set its secrets. The code it deploys does run with those secrets, though, so keep a deploy token as safe as the secrets themselves. Revoke it from the same page. Then, from the plugin's directory:

NOVINZO_DEPLOY_TOKEN=novinzo_deploy_… npx @emergente-labs/plugin-cli deploy

A deploy token works whether or not a repository is linked. When NOVINZO_DEPLOY_TOKEN is set, the CLI deploys with it even in GitHub Actions, and the deployment records the source the CLI reports rather than one GitHub vouched for.

Have the agent write it

Instead of a repository of your own, the store's owner can ask the dashboard's agent to build a plugin. The agent reserves one with a source Novinzo hosts: a git repository started from Novinzo's plugin template. It commits each change only once npm ci, npm test and the bundle pass, and nothing it writes runs for the store until you approve a deployment of a commit. That deployment checks novinzo.plugin.json, runs migrations and goes live as any other.

A plugin with a hosted source deploys only from it: it cannot be linked to a GitHub repository or given deploy tokens, since either could put other code under its grants and secrets. You still install it, grant it access and set its secrets on its page.

CLI options

The CLI installs as novinzo-plugin. deploy, dev and deployments accept --api-url, which falls back to NOVINZO_API_URL and then to https://dashboard.novinzo.com/api. novinzo-plugin bundle --output deployment.json builds as deploy does and writes what it would send, as JSON, without a credential and without deploying. deploy and bundle also accept these flags, and dev accepts all of them but --outdir:

FlagDefaultMeaning
--dir.The project directory, where novinzo.plugin.json is.
--outdirNoneUse this wrangler deploy --dry-run --outdir output instead of building.
--mainWrangler's mainThe module the Worker starts from.
--compatibility-dateWrangler's compatibility_dateThe Worker's compatibility date.

The CLI reads wrangler.jsonc, or wrangler.json when there is no wrangler.jsonc. Migrations come from the DB binding's migrations_dir, or migrations when it sets none.

What a deployment does

A deployment runs these steps in order, and stops at the first that fails:

  1. The first deployment creates the plugin's D1 database.
  2. Migrations that have not run yet run in name order, one at a time. Each one that succeeds is recorded at once.
  3. Novinzo uploads the Worker. Cloudflare checks that it starts.
  4. The deployment goes live: the plugin's next request runs the new code, and novinzo.plugin.json becomes what the plugin is.

When a step fails, the deployment is recorded as failed with Cloudflare's message, such as a syntax error in a migration or a Worker that does not start. The previous version keeps running, and the plugin stays as it was declared before. Fix the cause and deploy again.

Only one deployment of a plugin runs at a time. A deployment that has not gone live after 10 minutes is stopped and recorded as failed. One that never finished at all, for example because Novinzo restarted during it, stays listed as in progress until the next deployment or deletion, which records it as failed once 15 minutes have passed.

Changing permissions changes what the plugin asks for, not what it holds. A permission it newly asks for is not granted until you change its access. A permission it stops asking for is taken back from the installed plugin when the deployment goes live.

Limits

LimitValue
Bundle3 MiB of modules and migrations together, at most 50 modules and 200 migrations.
ModulesJavaScript ES modules, plus text (.txt, .html) and JSON modules your code imports.
Compatibility dateFrom wrangler.jsonc, today or earlier. nodejs_compat and global_fetch_strictly_public are always on.
CPU1 second per request. A plugin that needs more is stopped for that request.

Logs

Novinzo keeps the Worker's logs for 7 days: what it writes with console, uncaught exceptions and the outcome of each request. They are not shown in the dashboard; Novinzo support reads them to find why a plugin failed. Do not log secrets or buyers' personal data.

Migrations

Name migrations as wrangler does, such as 0001_purchases.sql. A migration that ran cannot be taken back, so it must stay in your repository, unchanged, before any new one. Novinzo refuses a deployment that changes, drops, or adds a new migration before a migration that already ran.

D1 runs each migration's statements in order. When a statement fails, the ones before it may already have run, and the migration is not recorded, so it runs again on the next deployment. The same happens to a migration that ran just as its deployment was stopped, before Novinzo recorded it. Write migrations that can run twice, such as CREATE TABLE IF NOT EXISTS.

What the Worker gets

Novinzo binds the same three things to every store-private plugin, and nothing else:

BindingValue
DBThe plugin's own D1 database.
CORE_FOR_PLUGINSThe platform API. Forward the invocation token of the request you are handling.
ENVIRONMENTproduction, or staging in Novinzo's staging environment.

Platform calls carry only the store's grants, exactly as for any other plugin. Your Worker never receives a platform secret, and cannot act for any other store.

There is no BACKEND binding. Send the backend RPCs your grants admit, such as the payment RPCs, to https://dashboard.novinzo.com/api/rpc with the invocation token of the request you are handling.

The vars, services and other bindings in your wrangler.jsonc are not deployed. Keep configuration in your code, and values your repository must not contain in secrets.

Scheduled work

Cron triggers in your wrangler.jsonc are not deployed either, so a scheduled handler never runs; deploy warns when triggers.crons declares any, from @emergente-labs/plugin-cli 0.1.5. Subscribe to hourly-tick instead: Novinzo sends POST /webhooks/hourly-tick with the store and the hour once an hour, at the start of the hour or within a few minutes of it. Keep the last hour you handled in D1 and, on each tick, run whatever came due up to hour, such as reminders a number of days after a purchase. A tick can arrive late or twice, and an hour Novinzo could not reach is not sent afterwards, so never count ticks to measure time.

Secrets

Give the Worker values your repository must not contain, such as an API key for a service it calls. Set them on the plugin's page after its first deployment; the Worker reads each one as env.NAME.

  • Names use capital letters, digits and underscores, starting with a letter. DB, CORE_FOR_PLUGINS and ENVIRONMENT are taken.
  • A value is at most 5 KiB. Novinzo never shows a value again, and never stores one: Cloudflare keeps it, encrypted, on the Worker.
  • Secrets stay set across deployments. Deploy tokens cannot list or set them, but every deployment runs with them.
  • Your plugin's own screen cannot read or set them. When one is missing, have the screen tell the seller to set it under Secrets on the plugin's page: Settings > Apps lists the plugin under Your plugins.

Delete

Deleting a store-private plugin is permanent. Novinzo deletes its Worker with its secrets and its database with everything the plugin stored, then uninstalls it and removes it from the store's API keys. Its code is never used again, and neither its repository nor its deploy tokens can deploy anything.

Deleting is refused while a deployment is in progress; try again once it has finished. If Cloudflare cannot delete the Worker or the database, the plugin stays installed and you can try again, but it may already have lost its Worker and secrets, or its database. Deleting again finishes the job; deploying again instead brings the plugin back, with an empty database if its database was deleted.

RPC reference

The dashboard uses these RPCs, which only the store's owner may call:

GroupRPCs
Store-private pluginsStorePrivatePlugins, CreateStorePrivatePlugin, RetireStorePrivatePlugin
Deploy tokensStorePrivatePluginDeployTokens, IssueStorePrivatePluginDeployToken, RevokeStorePrivatePluginDeployToken
DeploymentsStorePrivatePluginDeployments
SecretsStorePrivatePluginSecrets, SetStorePrivatePluginSecret, DeleteStorePrivatePluginSecret
RepositoryStorePrivatePluginRepositoryLink, LinkStorePrivatePluginRepository, ApproveStorePrivatePluginRepository, UnlinkStorePrivatePluginRepository
PreviewsStorePrivatePluginPreview, StartStorePrivatePluginStorefrontPreview, EndStorePrivatePluginPreview
Hosted sourcesCreateStorePrivatePluginSource, StorePrivatePluginSource, StorePrivatePluginSourceFile, ChangeStorePrivatePluginSource, DeployStorePrivatePluginSource

Install a store-private plugin with InstallPlugin, as any other. @emergente-labs/plugin-cli deploys through a separate endpoint, /plugin-deploy/rpc, which takes a GitHub Actions identity token or a deploy token instead of a session.

On this page