Skip to content

snizu app create

Write a small app that works, on plain Node with nothing to install. It installs on a store, checks webhooks, answers on stores' addresses and verifies both kinds of App Bridge token.

Node 22+2 min read

Usage

Usage
snizu app create <dir> [--template node]

Arguments and flags

  • <dir>pathrequired
    Where to write the app. A folder with a package.json already in it is refused. Its name becomes the package's name.
  • --templatenode
    The app to start from. node is the only one, and the default.

It needs no sign-in: the app is written from files inside the CLI.

What it writes

  • server.js
    Every route, on Node's own http module: the install, webhooks, the app proxy and the backends of an embedded page and a checkout block.
  • lib/verify.js
    Everything you have to check, written out so you can read it: webhook signatures, app proxy signatures, admin session tokens and checkout block tokens.
  • test/verify.test.js
    Tests for each check, run with npm test on Node's own test runner.
  • .env.example
    The variables the server reads: CLIENT_ID, CLIENT_SECRET, APP_URL, ADMIN_URL, API_URL, PORT.
  • package.json
    npm run dev (Node's --watch with .env) and npm test. No dependencies.
  • README.md, .gitignore
    What's where, and .env kept out of git.

The routes

  • GET /auth/start
    Sends a merchant to install the app. The state it sends is tied to their browser with a cookie.
  • GET /auth/callback
    Checks the state, then swaps the code for a token at /admin/v1/oauth/token. The store is the one the token endpoint names, never the one in the address.
  • POST /webhooks
    Checks the shop-signature on the raw body before reading it. See Verify webhook signatures.
  • /proxy/*
    Answers /apps/<your handle>/* on stores' addresses, once the signature on the query checks out. Add its address as app_proxy in your manifest.
  • GET /api/me
    Your embedded page's backend: checks the admin session token from @snizu/app-bridge.
  • GET /api/checkout-block
    Your checkout block's backend: checks its token from @snizu/app-bridge/checkout.

Examples

Terminal
$ snizu app create gift-wrap
✓ Wrote an app in /home/salma/gift-wrap.
Next: cd gift-wrap, then snizu app init to link it, then npm test and npm run dev.
$ cd gift-wrap
$ cp .env.example .env
$ npm test

Then link the folder to an app with snizu app init, and put the client ID and secret from the developer console in .env.

Was this page helpful?

Updated 25 Nov 2026