0gkitdocsGitHub

create-0gkit-app

The fastest way to start a 0G project — one command, a runnable app, no manual setup. Pairs with 0g dev for zero-faucet local development.

npm create 0gkit-app@latest my-app
cd my-app
0g dev          # in another terminal — starts the local devnet
npm run dev     # runs the scaffolded app

Works with any package manager (npm, pnpm, yarn, bun) — npm create 0gkit-app will install dependencies with whichever one you invoked it through.

What it does

create-0gkit-app is a thin scaffolder:

  1. Downloads the chosen template (degit a subtree of rajkaria/0g-ai-kit/templates/<name>) into your new project directory.
  2. Writes a network-aware .env.examplelocal ports for 0g dev, or the public Galileo testnet RPC.
  3. Installs dependencies with your package manager (skippable with --no-install).
  4. Runs git init and creates a single bootstrap commit (skippable with --no-git).
  5. Prints a "next step" banner telling you exactly what to run.

The whole flow is interactive by default. Pass --template and a name to skip the prompts.

Templates

NameUse case
storage-appUpload + download a file, verify the Merkle root.
inference-appOpenAI-shaped chat against 0G Compute.
attestation-verifyParse + verify a TEE attestation report (pure crypto, no network).
mcp-agentExpose every 0G primitive as MCP tools for Claude/Cursor/Cline/etc.
react-appNext.js App Router app using @foundryprotocol/0gkit-react hooks.

See Templates for descriptions, what each one uses, and how the file layout is organised.

Flags

FlagDefaultDescription
-t, --template <name>(prompt)One of the five templates above.
-n, --network <name>locallocal (pairs with 0g dev) or galileo.
--package-manager <pm>(auto-detected)pnpm / npm / yarn / bun.
--no-installinstall enabledSkip dependency install.
--no-gitgit init enabledSkip git init.

--network local writes a .env.example that points at the ports 0g dev exposes (8545 for the chain, 5678 for storage, etc.). --network galileo points the same keys at the public testnet endpoints — you'll need a funded Galileo key.

Project names

create-0gkit-app validates the project name and refuses anything that could escape the current directory or that npm would balk at:

  • ASCII letters, digits, _ and - only.
  • Max 64 characters.
  • No ., .., slashes, spaces, or path-escape sequences.

If the target directory already exists and is non-empty, the command exits with an error and writes nothing.

What gets generated

For --template storage-app --network local --no-git:

my-app/
├── package.json        # template-provided
├── tsconfig.json       # template-provided
├── src/
│   └── index.ts        # template-provided
├── README.md           # template-provided
├── .gitignore          # template-provided
└── .env.example        # WRITTEN by create-0gkit-app, points at 0g dev ports

After npm install you have a runnable script. npm run dev (or whatever the template defines) starts it.

Package name

The originally planned npm create 0g-app name is held by another npm publisher, so the working public command is npm create 0gkit-app.

Troubleshooting

Directory ./my-app is not empty — pick a different name, or remove the existing folder.

Template fetch failed — usually a network or GitHub-API issue. The templates are pulled from the public rajkaria/0g-ai-kit repository; check your connection and retry. Behind a corporate proxy, set HTTPS_PROXY.

The dev command didn't work — make sure you cd into the new directory first. The banner reminds you, but it's the most common first-day mistake.

Wrong package managercreate-0gkit-app detects the package manager from npm_config_user_agent. Force it with --package-manager pnpm (or npm / yarn / bun).