We’ve decided to make NetCoreTemplates/blazor-wasm a first class supported template that can be created with:
$ x new blazor-wasm ProjectName
It contains all our recommendations including a new recommended way for creating a Blazor Client with:
builder.Services.AddBlazorApiClient(
builder.Configuration["ApiBaseUrl"] ?? builder.HostEnvironment.BaseAddress);
Where it registers a JsonApiClient
(subclass of JsonHttpClient) using the recommended IHttpClientFactory
registration APIs.
This makes usage of our new ServiceStack.Blazor package containing all ServiceStack functionality specifically for Blazor WASM apps which currently contains the API Service Client as well as the <ErrorSummary>
and <ErrorField>
components used for form validation binding used throughout the App. We’ll look to adding more useful components in future.
Blazor Template Features
It includes a number of encapsulated functionality to show how we’d implement different features:
- https://blazor-wasm.jamstacks.net/bookings-crud - AutoQuery Bookings CRUD Example
- https://blazor-wasm.jamstacks.net/todomvc - TODOs MVC App
- https://blazor-wasm.jamstacks.net/hello - Simple API (Use empty ‘’ to see validation error)
- https://blazor-wasm.jamstacks.net/hello-secure - Same but requires Auth
- https://blazor-wasm.jamstacks.net/signin - Login Page with quick links (uses JWT Cookies)
- https://blazor-wasm.jamstacks.net/signup - Sign Up page to register new users
Links to source code used in each feature is at the bottom of each page
We’ve purposefully left out client validation & navigation hiding in a lot of places to demonstrate the server error & validation binding.
Markdown Support
We’ve also added markdown support which is best suited for maintaining docs & static content and included 2 docs for this template, the first explaining the included GitHub Actions which supports SSH deploying the CI built Docker image to a vanilla Linux Server. Basically after a 1-time setup on your remote Linux Server you can deploy each App by just filling in these GitHub Action Secrets.
And if you have many Apps (Like we do in NetCoreTemplates) each App only needs to define a DEPLOY_API
secret specifying the DNS domain name for your server and optionally (but recommended) DEPLOY_CDN
for the domain name your Repos GitHub Pages should use to host the Blazor WASM Client UI Static Assets.
The second doc just lists the benefits of using a CDN and how cheap the TCO is for hosting Apps.
Live Demo
The blazor-wasm
template uses the GitHub Actions to deploy the templates Live Demo:
- https://blazor-wasm.jamstacks.net GH Pages CDN hosting Blazor WASM Client
- https://blazor-wasm-api.jamstacks.net - both .NET Server + Blazor WASM Client
As we can see the potential for using Blazor WASM for internal LOB Apps this will be a first-class template we’ll continue to invest in and support going forward. Happy to answer any questions of feedback about the template.