i am new to ICP , i have created my first small counter project in Rust and React js , i am struggling to create a third canister. now i have backend and frontend. is it possible to create third canister in parent folder ? if yes, how ? if not , how do you do it?
Yes β with the new icp CLI this is pretty straightforward.
A project can have multiple canisters listed in the root icp.yaml, with each canister living in its own folder and defining its build in canister.yaml:
my-project/
βββ icp.yaml
βββ backend/
β βββ canister.yaml
βββ frontend/
β βββ canister.yaml
βββ worker/
βββ canister.yaml
Then add it to icp.yaml:
canisters:
- backend
- frontend
- worker
For Rust boilerplate you can also use:
icp new example --subfolder rust
and copy/adapt the generated Rust canister into your existing project.
After that:
icp deploy worker
will build, create and install it.
The new icp.yaml + per-canister canister.yaml structure is much nicer for multi-canister projects than the older dfx.json setup.
Also, if youβre building a React frontend against multiple ICP canisters, you might find our open-source ic-reactor project useful β it provides React/TypeScript tooling and hooks for working with canisters: documentation
Thank you , i have successful created a new canister ! a bit of time consuming thought! i appreciate your work and we hope in future a single cli will be created so that a single line will create a canister with all default files! thank you for ic-reactor too