apps/sanity-studio-plugin and talks to apps/hyperlocalise-web through /api/integrations/sanity/*. End-user workflow is in Localize Sanity Studio documents.
Authentication
Editors paste a Hyperlocalise API key into the plugin. The plugin sends it in theX-Hyperlocalise-Api-Key header on every request. The key needs files:read, files:write, jobs:read, and jobs:write.
The first request with a usable key creates a Sanity Studio plugin connection for it (resolveSanityConnectionForApiKey in apps/hyperlocalise-web/src/lib/sanity/connections.ts). Later requests reuse that connection. Disabling the connection under Integrations → Sanity Studio plugin or revoking the key stops the plugin.
/api/integrations/sanity/* allows any Studio origin and never allows credentials, because it authenticates only with the header. Self-hosted Studios on custom domains need no allowlist. GET /api/integrations/sanity/health needs no key and returns { "ok": true }.
App URL
The plugin defaults tohttps://www.hyperlocalise.com. A Studio overrides it with SANITY_STUDIO_HYPERLOCALISE_APP_URL, which Sanity’s build reads from the Studio environment. The in-repo dev studio’s .env.example sets it to http://localhost:3000. The plugin saves the app URL in settings storage per Sanity project and dataset.
Package and CI
- Source:
apps/sanity-studio-plugin(npm namesanity-plugin-hyperlocalise). - CI:
.github/workflows/sanity-studio-plugin.yml. - Publish: tag
sanity-studio-plugin-v*triggers.github/workflows/sanity-studio-plugin-publish.yml.
Release a new version
- Bump
versioninapps/sanity-studio-plugin/package.jsonand merge it tomain. - Tag the merge commit with the same version and push the tag, for example
sanity-studio-plugin-v1.0.1. The workflow fails if the tag andversiondiffer. - The workflow stages the release on npm with trusted publishing. Nothing is installable yet.
- A maintainer with 2FA approves it on npmjs.com under account settings → Staged Packages, or runs
npm stage list sanity-plugin-hyperlocaliseand thennpm stage approve <stage-id>. Usenpm stage reject <stage-id>to discard it.
1.1.0-beta.1, are staged under the next dist-tag.
The npm trusted publisher allows npm stage publish only. Do not enable Allow npm publish, because that lets the workflow skip approval. A staged version reserves its version number, so bump the version before you retry a rejected release.
Design notes: docs/adr/2026-10-20-sanity-studio-plugin-inspector.md.
