Skip to content

feat: add blazor-hello-world template (Blazor WASM .NET 10 + Motoko) - #40

Open
mitnick2012 wants to merge 4 commits into
dfinity:mainfrom
mitnick2012:main
Open

mitnick2012 wants to merge 4 commits into
dfinity:mainfrom
mitnick2012:main

Conversation

@mitnick2012

Copy link
Copy Markdown

Summary

Adds a new blazor-hello-world/ sub-template: full-stack Blazor WebAssembly (.NET 10) frontend + Motoko backend, deployed fully on-chain.

This follows up on the review suggestion that community Blazor examples don't belong in the main icp-cli repo and are better suited for icp-cli-templates as suggested by @marc0olo here.
So this PR contributes the example here instead, as a properly registered sub-template.

What's included

  • blazor-hello-world/ — 24-file template (icp.yaml, cargo-generate.toml, backend/, frontend/canister.yaml, frontend/vendor/assetstorage.wasm.gz, frontend/{{project-name}}/, scripts/fix-wsl-keyring.sh)
  • Registration: added "blazor-hello-world" to root cargo-generate.toml sub_templates
  • Docs: new row in root README.md Templates table
  • CI: new blazor-hello-world entry in tests/matrix.yaml (default permutation; asserts {{project-name}}-backend.hello("ICP") returns Hello, ICP! and curls {{project-name}}-frontend for HTTP 200)
  • Template hygiene per repo conventions:
    • No lock files committed (package-lock.json / Cargo.lock excluded via root .gitignore + template ignore)
    • Tilde (~) ranges in package.json so scaffolders get latest compatible patches/security fixes
    • frontend/vendor/ excluded from Liquid; bin/obj/node_modules in template ignore

Alignment with review feedback (from Marco)

  • Right repo: moved here to icp-cli-templates instead of an external example repo, as suggested.
  • Motoko recipe v5.0.0 / mops build: backend/mops.toml mirrors hello-world/motoko-backend/mops.toml, compilation is delegated to mops build.
  • @dfinity/agent vs js.icp.build/core: this template currently still bundles @dfinity/agent via webpack into a plain defer-loaded JS file (avoids the ES-module vs. Blazor IJSRuntime race). Happy to migrate to https://js.icp.build/core/latest/libs/agent in a follow-up if maintainers prefer, please advise whether you want that migration inside this PR or as a second step.

Verification

  • icp new --path ./icp-cli-templates --subfolder blazor-hello-world renders with exit 0, no bin//obj//node_modules/lock files, all {{project-name}} placeholders substituted
  • Fresh npm install + npm run build succeed in the scaffolded frontend (webpack bundle compiles)
  • icp deploy to local network serves the frontend over HTTP 200 (friendly domain + canister-id URL)

@mitnick2012
mitnick2012 requested a review from a team as a code owner October 4, 2026 23:21
@marc0olo

marc0olo commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

@mitnick2012 thanks for the contribution. I don't think it is likely that we merge this in to the official template repo.

if you provide the template in a dedicated git repo, you can share this with others and guide them to run icp new --git https://github.com/<org/user>/<repo>

@mitnick2012

Copy link
Copy Markdown
Author

Hi @marc0olo, as you suggested the template now lives in its own repo and is maintained by me:
https://github.com/mitnick2012

icp new icp-my-app --git https://github.com/mitnick2012/icp-cli-templates --subfolder blazor-hello-world

You mentioned the idea of listing community templates in the icp-cli-templates README or the icp-cli docs. Would you be open to a small "Community templates" section in the README, with a link to this one? It would make clear these are community-maintained and not supported by DFINITY.

If that works for you, I'm happy to open a README-only PR, or to wait if you'd rather handle this through the docs or the registry you mentioned.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants