Skip to content

ranzlee/razorx

Repository files navigation

RazorX

An ASP.NET and htmx meta-framework

The name RazorX represents the combination of ASP.NET Razor Components on the server with htmx on the client. ASP.NET Minimal APIs provide the request-response processing between the client and server. Razor Components are only used for server-side templating, and there are no dependencies on Blazor for routing or interactivity.

Getting started

Install the required dependencies, if necessary.

Download and install the template

  1. Download the Package/RazorX.Template.1.0.0-alpha.nupkg
  2. Install the template dotnet new install RazorX.Template.1.0.0-alpha.nupkg
  3. Create a new app with dotnet new razorx

[OR]

Build and install the template

  1. Clone the razorx repository.
  2. Use the /RxTemplatePack/makefile to build and install the template. If you're on Windows, you may need to create the template manually by copying the RxTemplate folder to RxTemplatePack/content and running the dotnet CLI commands in the makefile.
  3. Create a new app with dotnet new razorx.

Request/Response Cycle

The following diagram describes the flow of a request. The basic concept is to first route the request through a series of middleware, both global and endpoint specific (IEndpointFilters). This applies common behaviors like anti-forgery token validation, authorization policy enforcement, and model validation. Next, the request is routed to a specific handler (IRequestHandler Delegate) for processing application logic. The request handler will usually return a RazorComponentResult for creating an HTML response. Finally, HTMX may modify the DOM to swap partial content and trigger events specified in response headers. The events are handled with JavaScript event handlers in razorx.js.

RazorX Request-Response Cycle

Releases

No releases published

Packages

No packages published