Skip to content

Conversation

@marc0olo
Copy link
Member

@marc0olo marc0olo commented Feb 4, 2026

Summary

Comprehensive documentation for canister discovery, binding generation, and frontend development workflows.

New Documentation

File Description
docs/concepts/canister-discovery.md How icp deploy automatically injects PUBLIC_CANISTER_ID:* variables into all canisters; reading IDs in Rust/Motoko; ic_env cookie mechanism for frontend canister discovery
docs/concepts/binding-generation.md Generating TypeScript/Rust client bindings from Candid files using external tools (@icp-sdk/bindgen, candid crate)

Updated Documentation

File Changes
docs/guides/local-development.md Added "Frontend Development" section covering asset canisters, dev server setup (icp network status --json), and two development approaches
docs/reference/environment-variables.md Added "Canister Runtime Environment Variables" section documenting PUBLIC_CANISTER_ID:* and IC_ROOT_KEY
docs/concepts/build-deploy-sync.md Fixed broken links; clarified environment variable injection step in deploy sequence
docs/tutorial.md Added link to Canister Discovery concept docs
docs/index.md, docs/concepts/index.md Added navigation links to new concept pages
docs-site/astro.config.mjs Added sidebar entries for new documentation pages

Updated Example

File Changes
examples/.../vite.config.ts Simplified to use icp network status --json for all environments; proper ic_root_key cookie format
examples/.../App.tsx Fixed IC_ROOT_KEY type to Uint8Array; cleaner implementation
examples/.../README.md Complete rewrite explaining the ic_env cookie mechanism and dev server setup

Infrastructure Updates

File Changes
.claude/CLAUDE.md Added documentation standards: terminology guidelines (canister environment variables), link format rules for GitHub/Starlight dual rendering, verification requirements
scripts/prepare-docs.sh Fixed anchor link preservation when transforming .md links to Starlight URLs

Key Technical Details

  • Cookie key is ic_root_key (lowercase); library returns IC_ROOT_KEY as Uint8Array
  • All canister IDs are injected into every canister in the environment
  • Rust: use ic_cdk::api::env_var_value() + Principal::from_text()
  • Motoko: use Prim.envVar<system>() (available since Motoko 0.16.2) + Principal.fromText()

@marc0olo marc0olo requested a review from a team as a code owner February 4, 2026 17:36
execSync(`icp network status -e ${environment} --json`, { encoding: "utf-8" })
);
const rootKey: string = networkStatus.root_key;
const proxyTarget: string = networkStatus.api_url;
Copy link
Member Author

@marc0olo marc0olo Feb 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note:

  • the dev server wouldn't work correctly until we update the network status command to deliver the api_url


### Other Languages

The `didc` CLI generates bindings for various languages. See the [Candid repository](https://github.com/dfinity/candid) for available targets.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should have a note somewhere that not all generated bindings will work well with icp-cli.

  • The target canister id needs to be fixed, or
  • the target canister id has to be fetched from the environment variables.

@marc0olo marc0olo requested a review from raymondk February 5, 2026 10:43
@marc0olo marc0olo enabled auto-merge (squash) February 5, 2026 15:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants