Interactive Components Without JavaScript
The dominant model for interactive web applications involves shipping significant JavaScript to the browser. A large client-side framework handles state management, renders the UI, makes API calls, and manages the synchronization between browser state and server state.
This approach is capable, but it comes with costs: large initial bundles that slow down page load, complex state synchronization that produces subtle bugs, and a development model that doubles the surface area of the application.
Swifty takes a different approach.
Server-Driven Interactivity
Interactive components in Swifty are powered by a model where the server renders the UI and the browser handles minimal client-side coordination. When you type in a search field, a lightweight mechanism sends the input to the server, the server rerenders the list, and the updated list is applied to the page.
No client-side state management. No synchronization issues. The server is always the source of truth, and the browser renders what the server sends.
What This Enables
Instant field validation. As you type in a form field, the server validates the input and returns a validation message. The full power of server-side validation — database queries, business rule checks — is available during typing, not just on submit.
Live search and filtering. Typing in a filter field sends the filter to the server, which re-runs the query and returns the updated results. The list is always accurately filtered against the actual dataset.
Complex interactions without duplication. The business logic that governs form behavior, field visibility, and workflow state lives in one place on the server. The browser renders it; the server drives it.
The Performance Benefit
Smaller client-side bundles mean faster initial page loads. Less JavaScript means faster page parsing and rendering. The model scales better on low-end devices and slow connections than heavy client-side frameworks.
Server-driven interactivity is a different tradeoff, not an inferior one. For the kinds of interactions that business applications need, it's often the better choice.