Skip to content

Commit 4fcdb14

Browse files
marc0oloclaude
andauthored
docs(motoko): align Candid regeneration to mops generate candid backend (#1450)
* docs(motoko): use `mops generate candid backend` for Candid regeneration Align the "Updating the Candid interface" instructions across all Motoko examples to use `mops generate candid backend` (the canister name defined in `mops.toml`) instead of the low-level `$(mops toolchain bin moc) --idl -o ...` invocation. Also add the missing section to the two vetkeys examples whose frontends generate bindings from `backend/backend.did` via `@icp-sdk/bindgen` (encrypted_notes_app_vetkd, password_manager_with_metadata). password_manager is intentionally left out — its frontend talks to the backend via the Encrypted Maps client and does not consume the `.did`. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * chore(vetkeys): drop unused committed Candid file from password_manager The password_manager frontend talks to the backend purely through the `@icp-sdk/vetkeys` Encrypted Maps client and does not consume `backend/backend.did` (no `@icp-sdk/bindgen`, no generated bindings). Nothing else references the file, and `moc` generates the Candid interface as canister metadata at build time regardless. Remove the committed `backend/backend.did` and the now-unused `candid = "backend/backend.did"` line from `mops.toml`, matching the backend-only convention used elsewhere in the repo. Verified with `icp build` — the built wasm still embeds `icp:public candid:service`. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent ac14cb8 commit 4fcdb14

13 files changed

Lines changed: 29 additions & 112 deletions

File tree

‎motoko/cert-var/README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ npm run dev --prefix frontend
5252
If you change the Motoko source, regenerate `backend/backend.did`:
5353

5454
```bash
55-
$(mops toolchain bin moc) --idl -o backend/backend.did backend/app.mo
55+
mops generate candid backend
5656
```
5757

5858
## Security considerations and best practices

‎motoko/daily_planner/README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ npm run dev
3535
## Updating the Candid interface
3636

3737
```bash
38-
$(mops toolchain bin moc) --idl -o backend/backend.did backend/app.mo
38+
mops generate candid backend
3939
```
4040

4141
## Security considerations and best practices

‎motoko/filevault/README.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@ npm run dev
4040

4141
The `backend/backend.did` file defines the backend canister's public interface. The frontend TypeScript bindings are auto-generated from this file during the frontend build.
4242

43-
If you modify the backend's public API, regenerate the `.did` file using the Motoko compiler:
43+
If you modify the backend's public API, regenerate the `.did` file:
4444

4545
```bash
46-
$(mops toolchain bin moc) --idl -o backend/backend.did backend/app.mo
46+
mops generate candid backend
4747
```
4848

4949
## Security considerations and best practices

‎motoko/flying_ninja/README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ The `backend/backend.did` file defines the backend canister's public interface.
3939
If you modify the backend's public API, regenerate the `.did` file:
4040

4141
```bash
42-
$(mops toolchain bin moc) --idl -o backend/backend.did backend/app.mo
42+
mops generate candid backend
4343
```
4444

4545
## Security considerations and best practices

‎motoko/hello_world/README.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,10 @@ icp network stop
6262

6363
The `backend/backend.did` file defines the backend canister's public interface. The frontend TypeScript bindings are auto-generated from this file during the frontend build.
6464

65-
If you modify the backend's public API, regenerate the `.did` file using the Motoko compiler:
65+
If you modify the backend's public API, regenerate the `.did` file:
6666

6767
```bash
68-
$(mops toolchain bin moc) --idl -o backend/backend.did backend/app.mo
68+
mops generate candid backend
6969
```
7070

7171
## Security considerations and best practices

‎motoko/random_maze/README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ npm run dev --prefix frontend
3939
## Updating the Candid interface
4040

4141
```bash
42-
$(mops toolchain bin moc) --idl -o backend/backend.did backend/app.mo
42+
mops generate candid backend
4343
```
4444

4545
## Security considerations and best practices

‎motoko/superheroes/README.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@ npm run dev
4040

4141
The `backend/backend.did` file defines the backend canister's public interface. The frontend TypeScript bindings are auto-generated from this file during the frontend build.
4242

43-
If you modify the backend's public API, regenerate the `.did` file using the Motoko compiler:
43+
If you modify the backend's public API, regenerate the `.did` file:
4444

4545
```bash
46-
$(mops toolchain bin moc) --idl -o backend/backend.did backend/app.mo
46+
mops generate candid backend
4747
```
4848

4949
## Security considerations and best practices

‎motoko/vetkeys/basic_vetkd/README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ Open the frontend URL printed by `icp deploy`. When done: `icp network stop`
3737
## Updating the Candid interface
3838

3939
```bash
40-
$(mops toolchain bin moc) --idl -o backend/backend.did backend/app.mo
40+
mops generate candid backend
4141
```
4242

4343
## Security considerations and best practices

‎motoko/vetkeys/encrypted_notes_app_vetkd/README.md‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,14 @@ A single Motoko canister that stores encrypted notes. It is deployed automatical
5656

5757
A **Svelte** application providing a user-friendly interface for managing encrypted notes. Canister bindings are generated from `backend/backend.did` at build time by the `@icp-sdk/bindgen` Vite plugin.
5858

59+
## Updating the Candid interface
60+
61+
`backend/backend.did` defines the backend's public interface; the frontend bindings are generated from it during the build. If you change the backend's public API, regenerate it:
62+
63+
```bash
64+
mops generate candid backend
65+
```
66+
5967
## Limitations
6068

6169
This example app does not implement key rotation, which is strongly recommended in a production environment.

‎motoko/vetkeys/password_manager/backend/backend.did‎

Lines changed: 0 additions & 98 deletions
This file was deleted.

0 commit comments

Comments
 (0)