DEV Community

Cover image for Island Architecture in WebForms Core Technology
Elanat Framework
Elanat Framework

Posted on

Island Architecture in WebForms Core Technology

Introduction to Island Architecture

Island architecture is a modern web development pattern that emphasizes performance and efficiency by rendering the majority of a web page as static HTML, while isolating interactive components—referred to as "islands"—that require dynamic behavior. These islands are typically hydrated with JavaScript on the client side only where necessary, reducing overall JavaScript bundle sizes, improving load times, and minimizing resource consumption. This approach contrasts with traditional single-page applications (SPAs) that often hydrate the entire page with JavaScript, leading to slower initial loads and higher bandwidth usage.

At its core, island architecture is grounded in principles of modularity, partial interactivity, and optimization. It prioritizes delivering static content quickly while enabling targeted dynamic updates. Importantly, architectural patterns like this are based on principles, not tools. While front-end frameworks such as Astro or Deno's Fresh implement islands through client-side hydration of components, and some server-side frameworks handle rendering holistically, Elanat's WebForms Core technology achieves the same principles in a distinct way: by automating server-driven manipulation of specific HTML elements without relying on heavy client-side logic or full page reloads.

Understanding WebForms Core Technology

WebForms Core, introduced by Elanat in 2024, is a server-centric technology designed to manipulate DOM elements directly from the back end. It consists of two main components: a server-side WebForms class (available in multiple languages like C#, Python, PHP, Java, and more) and a lightweight client-side JavaScript library called WebFormsJS. The technology uses an event-driven structure, supporting all standard HTML events such as clicks, key presses, and drags.

When a page loads initially via a standard HTTP request, it renders as full static HTML. For interactive elements, WebFormsJS intercepts events (e.g., form submissions) and sends them to the server via XMLHttpRequest (AJAX). The server processes the request using the WebForms class and responds with concise commands in INI format—simple key-value pairs that instruct the client on precise DOM changes, such as adding, deleting, or modifying elements. This avoids full page reloads, preserves page state, and ensures low overhead in terms of memory, processing, and bandwidth.

Unlike front-end-focused island implementations that bundle and hydrate JavaScript components, WebForms Core shifts control to the server, where developers can write familiar back-end code to manage UI updates. This makes it compatible with various back-end frameworks and languages, reducing the need for front-end expertise.

How WebForms Core Automates Island Architecture

WebForms Core automates island architecture by treating the bulk of the page as static HTML while enabling server-orchestrated updates to isolated interactive "islands." This adheres to the pattern's principles—static-by-default with selective dynamism—but implements it differently: instead of client-side hydration, it uses server commands to dynamically alter specific DOM islands via the WebFormsJS library.

For instance, a static page might display a list of items (non-interactive island), but a form or button within it becomes an interactive island. When triggered, the server handles the logic and sends targeted INI commands to update only that island, such as removing an item or displaying feedback. This automation simplifies development: developers design standard HTML, add WebForms attributes, and control everything from the server without writing custom JavaScript for each interaction.

This server-driven approach differs from front-end frameworks, which often require bundling components and managing state client-side, or traditional server-side rendering, which might necessitate full reloads. WebForms Core's method ensures minimal client-side code, faster responses, and easier maintenance, embodying island principles without tool-specific constraints.

A Practical Example: Deleting Images with Dynamic Feedback

Interactions in WebForms Core technology are performed on the front-end, where the user's browser handles events and applies updates. However, development is centered on the server-side: the server processes logic and sends concise instructions to the client. WebFormsJS then interprets these instructions and applies them to the HTML page. This means the client browser executes behaviors based on server directives, rather than relying on front-end frameworks that operate entirely client-side. The server manages core logic, while the client simply interprets and displays results, striking a balance between server control and client responsiveness.

In this example of deleting an image file, the client sends the file name (or data ID) to the server upon user interaction. The server deletes the file from storage and sends a command to the client to remove the associated HTML tag, updating the UI dynamically without a full reload.

HTML Structure (Client-Side)

The page includes a form with interactive delete buttons next to images, representing isolated islands of interactivity within a mostly static page:

<!DOCTYPE html>
<html>
<head>
    <script src="web-forms.js"></script>
</head>
<body>
    <form method="post" action="/admin/images">
        <div>
            <img src="/image/Earth.jpg" title="Earth.jpg" />
            <input type="submit" name="Delete" value="Earth.jpg" />
        </div>
        <div>
            <img src="/image/Goat.jpg" title="Goat.jpg" />
            <input type="submit" name="Delete" value="Goat.jpg" />
        </div>
        <div>
            <img src="/image/Fenc.jpg" title="Fenc.jpg" />
            <input type="submit" name="Delete" value="Fenc.jpg" />
        </div>
        <div>
            <img src="/image/Beach.jpg" title="Beach.jpg" />
            <input type="submit" name="Delete" value="Beach.jpg" />
        </div>
    </form>
</body>
</html>
Enter fullscreen mode Exit fullscreen mode

The form and buttons form the interactive island, with WebFormsJS handling event submission via AJAX.

WebForms Core - Island Architecture

Server-Side Logic (C# Example Using WebForms Class)

On the server, the WebForms class processes the delete request, removes the file, and generates INI commands to update the client-side island:

string fileName = context.Request.Form["Delete"];

File.Delete("wwwroot/image/" + fileName);

WebForms form = new WebForms();

form.Delete("/" + InputPlace.Query($"img[title='{fileName}']"));

Control(form, true);
Enter fullscreen mode Exit fullscreen mode

When the user clicks the delete button for "Goat.jpg", the client sends the file name to the server. The server deletes the file and responds with INI commands like:

[web-forms]
de/*img[title$[eq];'Goat.jpg']=1
Enter fullscreen mode Exit fullscreen mode

This command instructs the client to delete the parent tag of the image with the matching title, removing the entire <div> containing the image and button.

How the Server and Client Interact

WebFormsJS receives the server command, interprets it, and applies the changes to the HTML page. In this case, after the deletion request, the client sees the relevant tag removed instantly, updating the interactive island while leaving the rest of the static page intact.

WebForms Core - Island Architecture

According to this example, the following pattern is deleted in the HTML section:

<div>
    <img src="/image/Goat.jpg" title="Goat.jpg" />
    <input type="submit" name="Delete" value="Goat.jpg" />
</div>
Enter fullscreen mode Exit fullscreen mode

The server expends minimal processing to build the INI template—comparable to generating JSON for front-end frameworks—ensuring efficiency. This automation demonstrates how WebForms Core handles island architecture: server-driven updates to specific DOM elements, enabling dynamic feedback with low client-side overhead.

Conclusion

WebForms Core technology from Elanat redefines how island architecture can be implemented, automating it through server-side control and partial DOM updates. By adhering to the pattern's principles while diverging from tool-dependent methods in front-end or traditional server-side frameworks, it offers a simpler, more performant alternative for modern web development. Developers can build interactive applications with less overhead, proving that true innovation lies in principles applied innovatively.

Top comments (0)