-
Notifications
You must be signed in to change notification settings - Fork 1
Architecture
eQuantic.UI is a self-contained UI framework for .NET that compiles C# into optimized JavaScript/TypeScript, eliminating the dependency on Node.js, npm, or external tools in the development workflow.
- 100% .NET: UI logic, state, and events written purely in C#.
- Self-Contained: ASP.NET Core serves as both host and compiler.
- Hybrid Compilation: Intelligent separation between static structure (Shell) and dynamic logic.
- Clean Architecture: Native support for DDD and CQRS.
The framework is supported by three main pillars that clearly separate responsibilities:
The heart of transformation. It uses Roslyn to analyze C# code and generate intermediate TypeScript code and optimized JavaScript.
- Strategy: Converts C# classes into native web components.
- Source Maps: Native support for C# debugging in the browser via VLQ-encoded maps.
- Output: Generates optimized bundles using an embedded Bun binary and extracts Static CSS for zero-runtime overhead.
A lightweight library (~15kb) running in the browser.
- Virtual DOM: Efficient reconciliation algorithm for UI updates.
- State Management: Reactive system inspired by React/Flutter, but without the overhead of heavy frameworks.
- Dispatcher: Manages events and server communication.
ASP.NET Core middleware that integrates the framework into the HTTP request pipeline.
-
Routing: Discovers pages marked with
[Page]attributes. - Server Actions: Secure RPC channel for C# -> C# calls.
- SSR: Initial server-side rendering for SEO and performance (LCP).
The compiler decides what is static and what should be dynamic to optimize the final bundle.
graph TD
A[C# Component] --> B{Analyser}
B -->|Structure| C[Static Shell (.static.js)]
B -->|Behavior| D[Dynamic Logic (.logic.js)]
C --> E[Bun Bundler]
D --> E
E --> F[Optimized Assets]
- Static Shell: Immutable widget tree compiled at build time.
- Dynamic Logic: Event handlers and state executing on the client.
-
Server Actions: Methods marked with
[ServerAction]remain on the server and receive automatic proxies on the client.
The framework supports native SSR for better SEO and initial load time.
The server executes the Build() method of C# components and generates pure HTML.
- Automatic SEO: Meta tags and OpenGraph generated automatically.
- Performance: The user sees content immediately, before the JS download.
Upon loading, the Runtime does not discard existing HTML.
- Reconciliation: It "walks" over the existing DOM.
- Event Attachment: Attaches only necessary event listeners without recreating elements.
- State: Restores initial state serialized in the HTML.
Communication between client and server via Server Actions is protected by default.
-
Authorization: Support for ASP.NET Core
[Authorize]attributes, Roles, and Policies. - Validation: Payloads are sanitized and validated (1MB limit, type whitelist).
- No API Exposure: No need to create manual Controllers; the framework generates secure RPC endpoints internally.