Web Development with WebStencils

Build modern web experiences using the WebStencils template engine in RAD Studio.

Web Development with WebStencils

Many Delphi and C++Builder teams want a modern web front end, but do not want to rewrite decades of trusted business logic in JavaScript frameworks that change every year.

WebStencils in RAD Studio gives you a clean, template-driven way to build modern, interactive web experiences directly from your existing Delphi or C++Builder server code, using familiar WebBroker or RAD Server projects.

Who this page is for

  • Teams with stable Delphi server code (WebBroker, DataSnap, RAD Server) that want a modern web UI.
  • Product owners who want to add web access for existing desktop solutions without a “big bang” rewrite.
  • Developers currently on older Delphi versions evaluating whether upgrading unlocks credible web options.
WebStencils Live Demo
Browse live the official WebStencils Demo hosted using Docker just clicking the link below.

Check a WebStencils demo running live

No downloads, no setup required: just click this link and start exploring.

wsdemo.embarcadero.com

Why WebStencils is compelling for existing Delphi codebases

Upgrading to a RAD Studio version that includes WebStencils turns your existing skills and code into a modern web delivery platform with the speed and security of native compiled code.

  • Reuse proven business logic Keep your validation, workflows, and data access in Delphi/C++Builder. WebStencils simply turns the results into clean HTML.
  • Modern UX without a front-end framework lock-in Use any CSS framework (Bootstrap, Tailwind, etc.) and JavaScript libraries you prefer, or combine WebStencils with HTMX for rich, dynamic behaviour with minimal JavaScript.
  • Fast, server-side rendering Pages are rendered on the server, which keeps SEO-friendly HTML, predictable performance, and easier debugging than client-heavy Single Page Applications (SPAs).
  • Clean separation of layout and logic Web designers can work on HTML/CSS templates, while Delphi developers focus on data and behaviour using WebStencils’ simple @ and { } syntax.
  • Low-risk modernization path Start by adding a small web surface area (admin portal, reporting dashboard, simple self-service pages) on top of your existing application, then expand over time.

WebStencils + HTMX: modern interactivity, Delphi-first

WebStencils is a template engine that understands your Delphi objects, datasets, and sessions. HTMX adds modern interaction patterns directly in HTML:

WebStencils and TailwindCSS
The CSS and JS agnostic nature of WebStencils allows using pretty much any popular library.
  • HTMX handles the browser side Add attributes to your HTML (such as hx-get, hx-post, hx-swap) to make parts of the page update dynamically without full reloads.
  • WebStencils handles the server side Use expressions like @dataset.FieldName, @if (...) { ... }, @foreach dataset { ... } and layout constructs like @LayoutPage / @RenderBody to generate HTML fragments or full pages from your RAD Server or WebBroker actions.
  • Ideal for incremental upgrades Start with simple, server-rendered navigation pages. Then progressively enhance sections with HTMX for live grids, inline editing, or dashboards, still powered by Delphi.

Free Guide - WebStencils & HTMX: Fast Modern Web Development with RAD Studio

Free white paper covering architectural patterns, step-by-step examples, and how to combine WebStencils with HTMX.

lp.embarcadero.com

Typical modernization journeys with WebStencils

1. Add a web portal on top of an existing system

  • Expose the most-used workflows from your desktop app as web pages (for example, customer self-service, reporting, or approvals).
  • Use WebStencils templates to render lists, details, and forms directly from your existing business logic.
  • Add HTMX for partial page updates so users enjoy a responsive experience without learning a SPA framework.

2. Standardise server-rendered HTML

WebStencils gives you a maintainable way to produce HTML from Delphi regardless of how you got here. In practice you might be replacing hand-maintained markup, tidying up after years of small fixes, or moving on from older approaches (for example CGI/ISAPI handlers or server-side scripts that are hard to evolve).

With shared templates you can:

  • Separate layout, data binding, and conditional logic cleanly.
  • Introduce a consistent shell using @LayoutPage and @RenderBody.
  • Use @ExtraHeader for page-specific CSS or JavaScript while keeping one base layout.

3. Deliver new REST + HTML experiences with RAD Server

RAD Server already gives you a strong REST-oriented server story. WebStencils fits alongside it when you also want browser-delivered HTML:

  • The same RAD Server module can expose both JSON endpoints and HTML responses, so operators and integrators are not two unrelated codebases.
  • WebStencils scaffolding and dataset-oriented templates help you build list, detail, and form-style pages quickly on top of data you already surface from Delphi.

Free RAD Server Guide

The official white paper covering architecture, setup, and deployment patterns for RAD Server-based APIs.

lp.embarcadero.com

First WebStencils project idea

  • Pick one narrow scenario: for example, “customer search and details” or “ticket list and status update”.
  • Implement it as a WebBroker or RAD Server module using WebStencils templates.
  • Use HTMX to make search, pagination, or inline updates feel instant, and gather user feedback before expanding.

Architecture at a glance

At a high level, a WebStencils-based web application looks like this:

  • RAD Studio server application (WebBroker or RAD Server) hosts your modules, business logic, and data access.
  • TWebStencilsEngine / TWebStencilsProcessor components load HTML templates, merge them with your objects, datasets, and session data, and output HTML.
  • HTMX-enhanced HTML in the browser calls back into REST endpoints or WebStencils-powered actions for partial updates.

This keeps server-side logic in Delphi/C++Builder, where your team already has deep expertise, and presentation in HTML, CSS, and lightweight browser tools that designers and frontend-minded developers can own.

WebStencils (RAD Studio DocWiki)

Official documentation covering WebStencils concepts, syntax, and how to use templates in WebBroker or RAD Server projects.

docwiki.embarcadero.com

WebBroker Sessions Management

How session state is created, stored, and managed in WebBroker applications—useful when building authenticated or multi-step WebStencils flows.

docwiki.embarcadero.com

Learn more and see it in action

Free Guide - WebStencils & HTMX: Fast Modern Web Development with RAD Studio

Free white paper covering architectural patterns, step-by-step examples, and how to combine WebStencils with HTMX.

lp.embarcadero.com

https://www.youtube.com/watch?v=1CVpPFvbIeU

WebStencils + HTMX walkthrough.

https://www.youtube.com/watch?v=MGihIG14Tfc

WebStencils in real-world scenarios and patterns teams use.

If you would like help mapping your specific project to a WebStencils-powered architecture, use the “Talk to a specialist” button on this page to discuss your upgrade path and first web deliverables.

Ready to take the next step?

Our migration specialists have helped thousands of Delphi and C++Builder developers modernize their legacy architecture safely and efficiently.