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:
- Downloads the chosen template (degit a subtree of
rajkaria/0g-ai-kit/templates/<name>) into your new project directory. - Writes a network-aware
.env.example—localports for0g dev, or the public Galileo testnet RPC. - Installs dependencies with your package manager (skippable with
--no-install). - Runs
git initand creates a single bootstrap commit (skippable with--no-git). - 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
| Name | Use case |
|---|---|
storage-app | Upload + download a file, verify the Merkle root. |
inference-app | OpenAI-shaped chat against 0G Compute. |
attestation-verify | Parse + verify a TEE attestation report (pure crypto, no network). |
mcp-agent | Expose every 0G primitive as MCP tools for Claude/Cursor/Cline/etc. |
react-app | Next.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
| Flag | Default | Description |
|---|---|---|
-t, --template <name> | (prompt) | One of the five templates above. |
-n, --network <name> | local | local (pairs with 0g dev) or galileo. |
--package-manager <pm> | (auto-detected) | pnpm / npm / yarn / bun. |
--no-install | install enabled | Skip dependency install. |
--no-git | git init enabled | Skip 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 manager — create-0gkit-app detects the package manager from
npm_config_user_agent. Force it with --package-manager pnpm (or npm /
yarn / bun).