Make DIG a first-class deploy target for the frameworks you already use. Build your app with Vite or Next.js, then ship it to a DIG capsule — a network no host can read, change, or take down — on Chia.
This repo is a small monorepo with two published packages:
| Package | What it is | Install |
|---|---|---|
@dignetwork/vite-plugin-dig |
A Vite plugin: injects a window.chia dev wallet during vite dev, and ships your build to a DIG capsule on publish. |
npm i -D @dignetwork/vite-plugin-dig |
@dignetwork/next-plugin-dig |
A Next.js static-export adapter: the same dev wallet shim + a publish step that ships out/ to a DIG capsule. |
npm i -D @dignetwork/next-plugin-dig |
Both do the same two things, the way each framework expects:
- Dev wallet, for free. During
devthey inject the@dignetwork/dig-sdkwindow.chiadev shim — the same injected-provider contract the SDK'sChiaProviderdetects in production — so you can build and exercise the wallet path locally without the DIG Browser or an extension. The shim guards on a real wallet (so the DIG Browser always wins) and refuses to fake a signature, so a dev is never misled. - Publish to a capsule. A
digDeploy()you call from apublishscript ships your built output to a DIG capsule viadigstore deploy, printing thechia:/// DIGHUb URL. Publishing spends $DIG, so it is a deliberate, credentialed step — never part of the default build.
Concepts. A store is your app's on-chain identity; a capsule (
storeId:rootHash) is one immutable published version of it.chia://is what a user clicks to open your verified app. Read more in the DIG docs.
These adapters are thin. All the heavy lifting lives in two places they compose:
@dignetwork/dig-sdk— the adapters reuse its proven, tested core (thedig.tomlreader,options > env > dig.toml > defaultconfig resolution, the eval-free dev-shim generator, and thedigstore deployrunner). They are adependency, so installing an adapter pulls the SDK in for you.digstore— the canonical deployer.digDeploy()shells out todigstore deploy --json, which advances the on-chain root, stages your build dir, and pushes the new capsule to DIGHUb. The adapters never hand-roll a deploy or a spend.
your app ──vite build / next build──▶ out dir
│ digDeploy() (publish script)
▼
digstore deploy --json ──▶ new capsule ──▶ chia:// + DIGHUb URL
Config (store-id, output-dir, build-command, message, network, remote, wait-timeout)
is read from your project's dig.toml, overridable by DIGSTORE_* env and by the digDeploy()
options, in that precedence — exactly the order digstore itself uses, so the adapters can never
disagree with the CLI. Secrets (the deploy key, a private-store salt) come from env only
(DIGSTORE_DEPLOY_KEY, DIGSTORE_STORE_SALT) so they never end up on the command line or in a
checked-in file.
Prefer it inside the SDK instead? @dignetwork/dig-sdk/vite and @dignetwork/dig-sdk/next expose
the same helpers from the SDK directly. These standalone packages are the framework-named home with a
stable error taxonomy + version()/capabilities() introspection on top.
See each package's README for the full quickstart:
- Vite →
packages/vite-plugin-dig - Next.js →
packages/next-plugin-dig
Both packages are built for automated consumers as well as humans:
- Typed exports +
.d.ts— every option, result, and error type is declared (noany). - Stable error codes. The publish path always throws a coded
DigAdapterError(.codeis one ofDIGSTORE_NOT_FOUND,DEPLOY_FAILED,DEPLOY_OUTPUT_UNPARSEABLE,INVALID_ARGUMENT) — branch on the code, not the message. The catalogue is exported asDIG_ADAPTER_ERROR_CODES. - Self-description.
version()returns the package semver (build-time injected, never drifts);capabilities()(aliasdescribe()) returns the framework, features, error codes, and docs link as machine-readable data.
npm install # installs both workspaces
npm run build # build both packages (ESM + CJS + .d.ts)
npm test # build + run node:test for both
npm run verify # typecheck + build + testEach package builds with tsup to ESM + CJS + .d.ts, is eval-free (CSP-safe), and runs on
Node 18+.
MIT — see LICENSE.