static-site
БесплатноБез исполняемых скриптовНе проверенDeploy a frontend or any static site to the IC with the @dfinity/static-site recipe (the certified-assets canister). Covers icp.yaml recipe config, SPA…
от jiayaoqijia★ 81 звезда на GitHubОб этом скилле
Static Site (Certified Assets)
What This Is
The @dfinity/static-site recipe deploys a static site — a built frontend, docs, or any folder of files — to the certified-assets canister on the Internet Computer, which serves it over HTTP with response certification. The canister certifies every response (certification v2 only, never the no_certification escape hatch, no way to turn it off), and a verifying HTTP gateway checks that proof before handing the response to the browser: visitors get content the canister provably committed to, not something altered in transit. Whether the proof is checked depends on the gateway the visitor goes through: https://<canister-id>.icp.net verifies, https://<canister-id>.raw.icp.net does not (Pitfall 14).
This is the recommended way to host a frontend on the IC going forward. The recipe bundles a matched pair — the canister and its sync plugin — pinned together by one version. You point it at your build directory; icp deploy uploads, certifies, and serves.
The older
@dfinity/asset-canisterrecipe (the SDK asset canister, configured with.ic-assets.json5) is still supported for existing projects but is no longer the recommended path. It is a different canister with a different config format and API — seereferences/legacy-asset-canister.md. To move an existing project over, seereferences/migrating-from-asset-canister.md.
Prerequisites
icp-cli—npm install -g @icp-sdk/icp-cli. The recipe pins the canister + sync-plugin pair, both pre-built, so a plaindir/build/presyncdeploy needs nothing else.ic-wasm—npm install -g @icp-sdk/ic-wasm. A separate binary, not bundled withicp-cli. This recipe shells out to it only when you set themetadatafield (the generated build guards oncommand -v ic-wasmand fails with "ic-wasm not found"); other official recipes need it unconditionally, so installing both up front is the safe default — see theicp-cliskill.- Your frontend's build toolchain (e.g. Node.js >= 22 for a Vite/React app).
Canister IDs and URLs
Static-site canisters are created per-project — there is no global canister ID. After deployment the canister ID is stored in .icp/<cache|data>/mappings/<environment>.ids.json. Managed networks (the local replica) are cache — .icp/cache/mappings/local.ids.json; connected networks (mainnet ic) are data — .icp/data/mappings/ic.ids.json.
| Environment | Browser URL |
|---|---|
| Local | http://<canister-name>.<environment>.localhost:8000 — the middle label is the environment name, local by default, so http://frontend.local.localhost:8000 (this is the URL icp deploy prints; http://<canister-id>.localhost:8000 also works — <canister-name>.localhost with no environment label does not) |
| Mainnet | https://<canister-id>.icp.net |
| Custom domain | https://yourdomain.com (with DNS configuration) |
icp.yaml Configuration
canisters:
- name: frontend
recipe:
type: "@dfinity/[email protected]"
configuration:
build:
- npm ci
- npm run build
dir: dist
Check the static-site releases for the latest version and pin it in the type field. Because the recipe pins a matched canister + plugin pair, there is no separate canister version to choose — the recipe version is the canister version.
The recipe takes four configuration fields:
| Field | Required | Description |
|---|---|---|
dir |
Yes | The single directory of built files to serve. The canister owns its whole URL space, so this is one directory, not a list. Vite → dist, Next.js export → out. |
build |
No | Shell commands run before the canister exists to produce dir (e.g. npm run build). No canister IDs are available yet. |
presync |
No | Shell commands run at sync time, after the canister exists, with deployed canister IDs exported as env vars. Use this to bake a canister ID into a frontend build (see below). |
metadata |
No | name/value/visibility entries baked into the canister wasm via ic-wasm. visibility is optional, public or private; omitted means private (ic-wasm's default), and only public sections are readable by anyone via icp canister metadata. Values are interpolated in a shell at build time, so $(…) works. |
Pitfalls
- Using
.ic-assets.json5with the static-site recipe..ic-assets.json5is the legacy asset canister's config file. The certified-assets canister does not read it — and because the plugin skips every dotfile and dot-directory (only.well-known/is exempt, Pitfall 12), a.ic-assets.json5in yourdiris not even uploaded. It is silentl
Установить static-site в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл static-site?
Deploy a frontend or any static site to the IC with the @dfinity/static-site recipe (the certified-assets canister). Covers icp.yaml recipe config, SPA routing with _redirects, custom headers/CSP with _headers, clean URLs, access protection for private apps, custom domains, and building against canister IDs. This is the recommended way to host frontends and static files on the IC. Also the entry point for the legacy @dfinity/asset-canister recipe and .ic-assets.json5 (see the legacy reference) and for migrating an existing asset canister to certified-assets. Use when hosting a frontend, deploying static files, an asset canister, or setting up SPA routing on the IC. Do NOT use for canister-level HTTP code patterns or custom domain DNS setup — use custom-domains for DNS.
Как установить скилл static-site?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл static-site запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic