Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
7ced866
feat: add Codespaces support to who_am_i examples (pilot)
marc0olo May 21, 2026
3f0a8fb
fix: add postAttachCommand to open README with Runme buttons on attach
marc0olo May 21, 2026
10d68bd
docs: improve Codespace resume guidance in both who_am_i READMEs
marc0olo May 21, 2026
ac9b17f
fix: use code -r to scope VS Code window to example subdirectory
marc0olo May 21, 2026
f27b777
fix: move Codespaces devcontainers to repo root .devcontainer/
marc0olo May 21, 2026
0bb4e03
fix: replace code -r with code README.md, suppress noisy notifications
marc0olo May 21, 2026
ecef03c
chore: remove per-example .devcontainer directories
marc0olo May 21, 2026
6256a86
fix: Codespaces DX improvements for who_am_i examples
marc0olo May 21, 2026
871cfe5
fix: route agent to port 8000 in Codespaces, use ?canisterId= URLs
marc0olo May 21, 2026
56c9881
feat: auto-deploy and open frontend URL on Codespace attach
marc0olo May 21, 2026
e3b5f6b
chore: improve postAttach transparency with status messages
marc0olo May 21, 2026
f237502
docs: re-add redeploy cell to Codespace actions (preserves state)
marc0olo May 21, 2026
b25182f
fix: suppress port 7863 notification (PocketIC internal port)
marc0olo May 21, 2026
f750b04
fix: suppress port 7864 notification (Runme extension process)
marc0olo May 21, 2026
3ca4221
fix: remove code --open-url (browser blocks programmatic tabs)
marc0olo May 21, 2026
abccf6b
fix: root key fetch and broken-pipe in Codespaces
marc0olo May 21, 2026
986af95
fix: use echo to pipe JSON to jq (printf omits trailing newline)
marc0olo May 21, 2026
f2306c7
revert: remove fetchRootKey logic from actor.js
marc0olo May 21, 2026
ebd5ee1
fix: add *.app.github.dev to gateway domains for Codespaces support
marc0olo May 21, 2026
1f73c78
revert: remove Codespaces host workarounds from actor.js and vite.con…
marc0olo May 21, 2026
128441d
fix: inject Codespaces domain into icp.yaml via postStart.sh
marc0olo May 21, 2026
e7a47f7
chore: centralize devcontainer scripts and add generic CODESPACE.md
marc0olo May 21, 2026
50b20cd
refactor: extract URL display to show-urls.sh
marc0olo May 21, 2026
37e2ef6
docs: clean up Codespace section in who_am_i READMEs
marc0olo May 22, 2026
6b2f799
chore: remove Runme, add startup editor suppression, document URL lim…
marc0olo May 22, 2026
779dbfa
chore: improve Codespace UX for who_am_i examples
marc0olo May 22, 2026
d4ab1f9
chore: update port labels to ICP and Vite
marc0olo May 22, 2026
e8cc740
feat: add root devcontainer for local multi-example development
marc0olo May 22, 2026
57e1fb2
fix: use fully qualified rust-lang.rust-analyzer extension ID
marc0olo May 22, 2026
3da3378
docs: update README with icp-cli, Codespaces, and Dev Containers
marc0olo May 22, 2026
f7e3542
docs: remove ICP Ninja section and fix security best practices URL
marc0olo May 22, 2026
638669e
chore: remove NINJA_CONTRIBUTING.md
marc0olo May 22, 2026
89eff98
docs: refurbish ADDING_AN_EXAMPLE.md
marc0olo May 22, 2026
cd8c55e
docs: remove outdated portal submodule documentation section
marc0olo May 22, 2026
d9680c1
docs: remove ICP Ninja reference and update example submission guidance
marc0olo May 22, 2026
cc1b1ca
feat: add Codespaces support to hello_world examples
marc0olo May 22, 2026
04a43dc
feat: add Makefiles with tests and CI workflows for hello_world and w…
marc0olo May 22, 2026
1c50536
docs: add workflow template, clarify npm run dev, update contributing…
marc0olo May 22, 2026
f21fbb4
fix: handle icp.yaml without a network section in postStart.sh
marc0olo May 22, 2026
a53a79b
fix: use correct networks.local structure when appending to icp.yaml
marc0olo May 22, 2026
adde114
fix: networks is a sequence not a map in icp.yaml
marc0olo May 22, 2026
5f21a7e
fix: add Vite devserver domain to gateway domains in postStart.sh
marc0olo May 22, 2026
af48b75
fix: ensure network is running in postAttach.sh
marc0olo May 22, 2026
58533d0
fix: wait for ICP network to be ready before deploying
marc0olo May 22, 2026
608944c
fix: remove redundant network start and polling from postAttach.sh
marc0olo May 22, 2026
6db9783
fix: wait for network readiness in postStart.sh before returning
marc0olo May 22, 2026
f71ef43
fix: add set -e to lifecycle scripts and remove unnecessary polling
marc0olo May 22, 2026
9a8f53d
refactor: rename canisters to backend/frontend in who_am_i examples
marc0olo May 22, 2026
b907833
chore: bump moc/core, use --default-persistent-actors, pin recipe fix…
marc0olo May 22, 2026
985dacd
docs: add AGENTS.md and CLAUDE.md with example structure guidelines
marc0olo May 22, 2026
5d98d08
docs: instruct agents to fetch ICP skills before working
marc0olo May 22, 2026
9b30706
fix: add paths filter to ninja_pr_checks workflow
marc0olo May 22, 2026
cc1cdd4
fix: pin Motoko recipe to immutable commit SHA
marc0olo May 26, 2026
d19e1c6
refactor: adopt new Motoko recipe format (v5 schema)
marc0olo May 26, 2026
f3f3bb4
fix: remove deleted examples from ninja_pr_checks paths filter
marc0olo May 26, 2026
38f1910
chore: switch to official dfinity icp-dev-env images v0.1.0
marc0olo Jun 1, 2026
eb38b03
docs: clarify why icp deploy URLs don't work in Codespaces
marc0olo Jun 1, 2026
411331b
docs: improve URL command wording in CODESPACE.md
marc0olo Jun 1, 2026
8db6ba9
feat: migrate hello_world and who_am_i to icp-cli, drop Codespaces su…
marc0olo Jun 2, 2026
2e73186
docs: add devcontainer removal step to migration checklist
marc0olo Jun 2, 2026
59226a6
fix: remove hardcoded workspaceFolder from root devcontainer
marc0olo Jun 2, 2026
690cf15
fix: remove CODESPACE.md files, fix AGENTS.md recipe SHA and prerequi…
marc0olo Jun 2, 2026
a2a90e9
style: use plain bullets for prerequisites instead of checkboxes
marc0olo Jun 2, 2026
de8e091
docs: clarify educational focus and acceptance criteria for new examples
marc0olo Jun 2, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"name": "ICP Examples (Motoko + Rust)",
"image": "ghcr.io/dfinity/icp-dev-env-all:0.1.0",
"forwardPorts": [8000, 5173],
"portsAttributes": {
"8000": {
"label": "ICP",
"onAutoForward": "ignore"
},
"5173": {
"label": "Vite",
"onAutoForward": "openBrowser"
}
},
"customizations": {
"vscode": {
"extensions": [
"dfinity-foundation.vscode-motoko",
"rust-lang.rust-analyzer"
],
"settings": {
"git.openRepositoryInParentFolders": "always",
"workbench.startupEditor": "none",
"workbench.editorAssociations": {
"*.md": "vscode.markdown.preview.editor"
}
}
}
}
}
4 changes: 1 addition & 3 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# Contributing

> For ICP Ninja: check [NINJA_CONTRIBUTING.md](./../NINJA_CONTRIBUTING.md) for how to contribute a project to ICP Ninja.

Thank you for your interest in contributing to example apps for the Internet Computer.
By participating in this project, you agree to abide by our [Code of Conduct](./CODE_OF_CONDUCT.md).

Expand Down Expand Up @@ -116,4 +114,4 @@ To open a new issue:

### Submitting your own example

We're not accepting community examples at this time -- we have something better planned.
See [ADDING_AN_EXAMPLE.md](./../ADDING_AN_EXAMPLE.md) for guidelines on how to structure and submit a new example.
35 changes: 35 additions & 0 deletions .github/workflow-template.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Workflow template for ICP examples.
# Copy this file to .github/workflows/<example_name>.yml and replace the placeholders.
#
# PLACEHOLDERS:
# <example_name> e.g. hello_world
# <language> motoko | rust
# <image> ghcr.io/dfinity/icp-dev-env-motoko | ghcr.io/dfinity/icp-dev-env-rust

name: <example_name>

on:
push:
branches:
- master
pull_request:
paths:
- <language>/<example_name>/**
- .github/workflows/<example_name>.yml

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
<language>-<example_name>:
runs-on: ubuntu-24.04
container: <image>
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
- name: Deploy and test
working-directory: <language>/<example_name>
run: |
icp network start -d
icp deploy
make test
40 changes: 40 additions & 0 deletions .github/workflows/hello_world.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: hello_world

on:
push:
branches:
- master
pull_request:
paths:
- motoko/hello_world/**
- rust/hello_world/**
- .github/workflows/hello_world.yml

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
motoko-hello_world:
runs-on: ubuntu-24.04
container: ghcr.io/dfinity/icp-dev-env-motoko:0.1.0
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
- name: Deploy and test
working-directory: motoko/hello_world
run: |
icp network start -d
icp deploy
make test

rust-hello_world:
runs-on: ubuntu-24.04
container: ghcr.io/dfinity/icp-dev-env-rust:0.1.0
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
- name: Deploy and test
working-directory: rust/hello_world
run: |
icp network start -d
icp deploy
make test
48 changes: 44 additions & 4 deletions .github/workflows/ninja_pr_checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,50 @@ on:
pull_request:
branches:
- master
paths:
- 'hosting/**'
- 'motoko/backend_only/**'
- 'motoko/canister_logs/**'
- 'motoko/classes/**'
- 'motoko/basic_bitcoin/**'
- 'motoko/daily_planner/**'
- 'motoko/evm_block_explorer/**'
- 'motoko/filevault/**'
- 'motoko/flying_ninja/**'
- 'motoko/llm_chatbot/**'
- 'motoko/query_stats/**'
- 'motoko/send_http_get/**'
- 'motoko/send_http_post/**'
- 'motoko/superheroes/**'
- 'motoko/threshold-ecdsa/**'
- 'motoko/threshold-schnorr/**'
- 'rust/backend_only/**'
- 'rust/backend_wasm64/**'
- 'rust/basic_bitcoin/**'
- 'rust/canister-info/**'
- 'rust/canister_logs/**'
- 'rust/basic_ethereum/**'
- 'rust/candid_type_generation/**'
- 'rust/daily_planner/**'
- 'rust/evm_block_explorer/**'
- 'rust/flying_ninja/**'
- 'rust/guards/**'
- 'rust/llm_chatbot/**'
- 'rust/performance_counters/**'
- 'rust/periodic_tasks/**'
- 'rust/qrcode/**'
- 'rust/query_stats/**'
- 'rust/send_http_get/**'
- 'rust/send_http_post/**'
- 'rust/simd/**'
- 'rust/threshold-ecdsa/**'
- 'rust/unit_testable_rust_canister/**'
- 'rust/photo_gallery/**'
- 'rust/inter-canister-calls/**'
- 'rust/x509/**'
- 'rust/receiving-icp/**'
- 'rust/exchange-rates/**'
- '.github/workflows/ninja_pr_checks.yml'

concurrency:
group: ninja-pr-checks-${{ github.workflow }}-${{ github.ref }}
Expand Down Expand Up @@ -41,15 +85,13 @@ jobs:
["EVM Block Explorer (Motoko)"]="motoko/evm_block_explorer"
["FileVault (Motoko)"]="motoko/filevault"
["Flying Ninja (Motoko)"]="motoko/flying_ninja"
["Hello World (Motoko)"]="motoko/hello_world"
["LLM Chatbot (Motoko)"]="motoko/llm_chatbot"
["Query Stats (Motoko)"]="motoko/query_stats"
["Send HTTP Get (Motoko)"]="motoko/send_http_get"
["Send HTTP Post (Motoko)"]="motoko/send_http_post"
["Superheroes (Motoko)"]="motoko/superheroes"
["Threshold ECDSA (Motoko)"]="motoko/threshold-ecdsa"
["Threshold Schnorr (Motoko)"]="motoko/threshold-schnorr"
["Who Am I (Motoko)"]="motoko/who_am_i"
["Rust backend (Rust)"]="rust/backend_only"
["Rust backend Wasm64 (Rust)"]="rust/backend_wasm64"
["Basic Bitcoin (Rust)"]="rust/basic_bitcoin"
Expand All @@ -61,7 +103,6 @@ jobs:
["EVM Block Explorer (Rust)"]="rust/evm_block_explorer"
["Flying Ninja (Rust)"]="rust/flying_ninja"
["Guards (Rust)"]="rust/guards"
["Hello World (Rust)"]="rust/hello_world"
["LLM Chatbot (Rust)"]="rust/llm_chatbot"
["Performance Counters (Rust)"]="rust/performance_counters"
["Periodic Tasks (Rust)"]="rust/periodic_tasks"
Expand All @@ -72,7 +113,6 @@ jobs:
["SIMD (Rust)"]="rust/simd"
["Threshold ECDSA (Rust)"]="rust/threshold-ecdsa"
["Unit Testable Canister (Rust)"]="rust/unit_testable_rust_canister"
["Who Am I (Rust)"]="rust/who_am_i"
["Photo Gallery (Rust)"]="rust/photo_gallery"
["Inter-canister calls (Rust)"]="rust/inter-canister-calls"
["X.509 (Rust)"]="rust/x509"
Expand Down
40 changes: 40 additions & 0 deletions .github/workflows/who_am_i.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: who_am_i

on:
push:
branches:
- master
pull_request:
paths:
- motoko/who_am_i/**
- rust/who_am_i/**
- .github/workflows/who_am_i.yml

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
motoko-who_am_i:
runs-on: ubuntu-24.04
container: ghcr.io/dfinity/icp-dev-env-motoko:0.1.0
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
- name: Deploy and test
working-directory: motoko/who_am_i
run: |
icp network start -d
icp deploy
make test

rust-who_am_i:
runs-on: ubuntu-24.04
container: ghcr.io/dfinity/icp-dev-env-rust:0.1.0
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
- name: Deploy and test
working-directory: rust/who_am_i
run: |
icp network start -d
icp deploy
make test
47 changes: 28 additions & 19 deletions ADDING_AN_EXAMPLE.md
Original file line number Diff line number Diff line change
@@ -1,40 +1,49 @@
# How to add a new example

> For ICP Ninja: check [NINJA_CONTRIBUTING.md](./NINJA_CONTRIBUTING.md) for how to contribute a project to ICP Ninja.
## Purpose and acceptance criteria

Examples in this repository have an **educational focus**. Each example is intended to demonstrate a specific ICP capability or pattern, and should be suitable for reference from the [ICP developer documentation](https://docs.internetcomputer.org).

**We do not accept general-purpose or arbitrary examples.** Before opening a PR, confirm that:

- The example demonstrates a distinct ICP concept not already covered by an existing example.
- There is a clear home for it in the developer documentation (an existing or planned guide, tutorial, or reference page).
- The DFINITY DX team has agreed to maintain it long-term.

If you are unsure whether your example fits, open an issue first to discuss it with the maintainers before investing time in an implementation.

---

Each example should be available in both Rust and Motoko variations, implementing the same Candid interface (and, ideally, semantics).

To illustrate the pattern, this repo now contains one such example, project `hello_world`:
To illustrate the pattern, this repo contains one such example, project `hello_world`:

`motoko/hello_world`
`rust/hello_world`
```
motoko/hello_world
rust/hello_world
```

When adding a new `dfx` generated project, make sure to delete its GitHub metadata files (`.gitignore`, `.git` etc).
When adding a new project, make sure to delete any generated GitHub metadata files (`.gitignore`, `.git` etc).

Each project should include a language-specific README.md that also links to the corresponding README.md of its counterpart in another language, making it easy for language-curious readers to explore both implementations.

## CI

Apart from the standard `dfx` material, each project should provide a `Makefile` used by GitHub Actions CI to run (very) basic tests.
Each project should provide a `Makefile` with a `test` target that runs basic canister tests using `icp canister call`. Each example also needs a GitHub Actions workflow file at `.github/workflows/<example_name>.yml`.

For each example, there is a single CI file with four build actions to produce Darwin and Linux builds and tests of the Motoko/Rust, projects, such as:
Use the workflow template as a starting point:

```
.github/workflows/hello_world.yml
.github/workflow-template.yml
```

Implementing the GitHub action will ensure it runs in CI and helps keep examples in sync with releases of `dfx`.

## Documentation
Copy it, replace the placeholders, and add the appropriate container image:

For your new example to be included in the ICP developer documentation, make sure you update the `samples` submodule in the portal repository to point to the latest commit in this examples repository using the following command:

```bash
git submodule update --remote submodules/samples
```
- Motoko: `ghcr.io/dfinity/icp-dev-env-motoko`
- Rust: `ghcr.io/dfinity/icp-dev-env-rust`

After you run this command, commit the changes to a new PR to have them merged into the portal repo.
See `hello_world` and `who_am_i` for reference implementations. Workflows run on Linux only using container images — no provision scripts needed.

## Issues
## Notes

While this structure leads to some duplication (especially shared components like frontend code) it ensures that Motoko users can focus solely on Motoko-specific content, and likewise for Rust users. It also enables easily finding language-specific examples when a given use case is not easily supported in the other language.
While this structure leads to some duplication (especially shared frontend code) it ensures that Motoko users can focus solely on Motoko-specific content, and likewise for Rust users. It also enables easily finding language-specific examples when a given use case is not easily supported in the other language.
Loading
Loading