{"id":27206808,"url":"https://github.com/sample-by-jsakamoto/blazor-clientsideblazorssr","last_synced_at":"2026-06-23T03:31:53.294Z","repository":{"id":147941845,"uuid":"223703356","full_name":"sample-by-jsakamoto/Blazor-ClientSideBlazorSSR","owner":"sample-by-jsakamoto","description":"This sample code describe that how to enable server-side rendering on a client-side blazor application.","archived":false,"fork":false,"pushed_at":"2021-04-12T12:32:47.000Z","size":232,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"net5","last_synced_at":"2025-08-08T01:20:59.952Z","etag":null,"topics":["blazor","blazor-client","blazor-webassembly","serverside-rendering","ssr"],"latest_commit_sha":null,"homepage":null,"language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sample-by-jsakamoto.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-11-24T06:39:56.000Z","updated_at":"2021-04-12T12:32:50.000Z","dependencies_parsed_at":"2023-05-28T02:00:10.909Z","dependency_job_id":null,"html_url":"https://github.com/sample-by-jsakamoto/Blazor-ClientSideBlazorSSR","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/sample-by-jsakamoto/Blazor-ClientSideBlazorSSR","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sample-by-jsakamoto%2FBlazor-ClientSideBlazorSSR","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sample-by-jsakamoto%2FBlazor-ClientSideBlazorSSR/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sample-by-jsakamoto%2FBlazor-ClientSideBlazorSSR/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sample-by-jsakamoto%2FBlazor-ClientSideBlazorSSR/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sample-by-jsakamoto","download_url":"https://codeload.github.com/sample-by-jsakamoto/Blazor-ClientSideBlazorSSR/tar.gz/refs/heads/net5","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sample-by-jsakamoto%2FBlazor-ClientSideBlazorSSR/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34674702,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-23T02:00:07.161Z","response_time":65,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["blazor","blazor-client","blazor-webassembly","serverside-rendering","ssr"],"created_at":"2025-04-09T23:55:40.772Z","updated_at":"2026-06-23T03:31:53.274Z","avatar_url":"https://github.com/sample-by-jsakamoto.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Sample Code: How to enable Server-Side Rendering on Client-Side Blazor App?\n\n## Summary\n\nThis sample code describes that how to enable server-side rendering on a client-side blazor application.\n\n## Pre required\n\n- [.NET 5.0 SDK](https://dotnet.microsoft.com/download/dotnet/5.0)\n- A Client-Side Blazor application with ASP.NET Core hosted project.\n\n## Migration Step\n\n1. Remove \"index.html\" from the client project, and add \"_Host.cshtml\" Razor Page file to the server project, instead.  \nThe contents of \"_Host.cshtml\" is almost a copy of \"index.html\", however, it has server-side rendering instruction in the `\u003capp\u003e` element.\n\n```html\n\u003capp\u003e\n  ...\n  \u003ccomponent type=\"typeof(App)\" render-mode=\"Static\" /\u003e\n```\n\n2. Add Razor Pages feature to the server at server-side Startup class, and change the fallback page specification to the URL of \"_Host.razor\" Razor Page.\n\n```csharp\npublic class Startup\n{\n  public void ConfigureServices(IServiceCollection services)\n  {\n    services.AddRazorPages();\n    ...\n  }\n\n  public void Configure(IApplicationBuilder app, IWebHostEnvironment env)\n  {\n    ...\n    app.UseEndpoints(endpoints =\u003e\n    {\n      ...\n      endpoints.MapFallbackToPage(\"/_Host\");\n    });\n    ...\n```\n\nThat's all!\n\n## Appendix\n\nHowever, the `HttpClient` dependency injection at Blazor components might be failed when it's rendering in server-side.\n\nTherefore, those Blazor components such as `Fetch.razor` have to change that implementation.\n\nYou can see one of the examples ways at [the commit 18298a37](https://github.com/sample-by-jsakamoto/Blazor-ClientSideBlazorSSR/commit/18298a37fe85c274431fba83d0b2127f7265ff6a).\n\n\n# License\n\nThis sample code provides under [The Unlicense](LICENSE).","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsample-by-jsakamoto%2Fblazor-clientsideblazorssr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsample-by-jsakamoto%2Fblazor-clientsideblazorssr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsample-by-jsakamoto%2Fblazor-clientsideblazorssr/lists"}