docs: add canister discovery, binding generation, and frontend development docs#338
Open
docs: add canister discovery, binding generation, and frontend development docs#338
Conversation
marc0olo
commented
Feb 4, 2026
| execSync(`icp network status -e ${environment} --json`, { encoding: "utf-8" }) | ||
| ); | ||
| const rootKey: string = networkStatus.root_key; | ||
| const proxyTarget: string = networkStatus.api_url; |
Member
Author
There was a problem hiding this comment.
note:
- the dev server wouldn't work correctly until we update the
network statuscommand to deliver theapi_url
raymondk
reviewed
Feb 4, 2026
|
|
||
| ### Other Languages | ||
|
|
||
| The `didc` CLI generates bindings for various languages. See the [Candid repository](https://github.com/dfinity/candid) for available targets. |
Contributor
There was a problem hiding this comment.
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.
raymondk
reviewed
Feb 4, 2026
|
|
||
| ## Automatic Canister ID Injection | ||
|
|
||
| icp-cli solves this by automatically injecting canister IDs as environment variables during deployment. |
Contributor
There was a problem hiding this comment.
Suggested change
| icp-cli solves this by automatically injecting canister IDs as environment variables during deployment. | |
| icp-cli solves this by automatically injecting canister IDs as canister environment variables during deployment. |
We must be careful to distinguish between "environment variables" that folks are used to and "canister environment variables"
Maybe this should link to the canister environment variables docs
raymondk
reviewed
Feb 4, 2026
| ).unwrap(); | ||
| ``` | ||
|
|
||
| **Motoko** does not currently have native support for reading canister environment variables. Use init arguments instead — pass canister IDs when initializing the canister: |
Contributor
There was a problem hiding this comment.
I don't think this is correct - https://github.com/caffeinelabs/motoko/blob/a4cc7fe65bdc105fb453ba98de18beb8688b1e41/Changelog.md?plain=1#L167
There is an API to fetch a canister environment variable in motoko (caffeinelabs/motoko#5443)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add documentation for canister discovery, binding generation, and frontend development workflows.
New Documentation
docs/concepts/canister-discovery.mdicp deployinjectsPUBLIC_CANISTER_ID:*variables into all canisters;ic_envcookie mechanism for frontends; Rust/Motoko patterns for reading IDsdocs/concepts/binding-generation.mdUpdated Documentation
docs/guides/local-development.mddocs/reference/environment-variables.mdPUBLIC_CANISTER_ID:*andIC_ROOT_KEYdocs/concepts/build-deploy-sync.mddocs/tutorial.mddocs/index.md,docs/concepts/index.mddocs-site/astro.config.mjsUpdated Example
examples/.../vite.config.tsicp network status --jsonfor all environments; properic_root_keycookie formatexamples/.../App.tsxIC_ROOT_KEYtype toUint8Array; cleaner implementationexamples/.../README.mdic_envcookie mechanismKey Technical Details
ic_root_key(lowercase); library returnsIC_ROOT_KEYasUint8Arrayic_cdk::api::env_var_value()+Principal::from_text()