Jails is a small, DOM-first JavaScript framework for adding interactive components to server-rendered and static HTML.
Build UI components with plain JavaScript, without JSX or a Virtual DOM. It works especially well with SSG, SSR, Astro and progressive-enhancement architectures.
Simple, Fast, and Lightweight.
Why Jails.js?
Functional, but in the Javascript way. Use the best of JavaScript's functional features to build clean, composable components.
Small, focused chunks of interactivity within static and server-rendered web pages. Load only what you need.
Integrate your application with any other JavaScript library easily. Works seamlessly with your existing stack.
Jails makes blazing-fast apps effortless—optimize page loads and deliver performance users notice. 🚀
Developer Experience
Jails.js keeps things minimal. Register a component, bind events, and you're done. No complex build steps, no virtual DOM overhead.
Write plain JavaScript with a thin layer of structure. Your components stay small, testable, and framework-agnostic.
import { type Component } from 'jails-js'
export default function appCounter({ main, on, state }: Component) {
main( _ => {
on('click', '[data-add]', add)
on('click', '[data-subtract]', subtract)
})
const add = () => {
state.set( s => s.count += 1 )
}
const subtract = () => {
state.set( s => s.count -= 1 )
}
}
export const model = {
count: 0
}
A Comparison of the same TodoMVC app built with Jails and Vanilla Javascript.
| Jails Version | Vanilla JS Version | |
|---|---|---|
| Number of Files | 1 Ts File | 7 Js Files |
| Lines Of Code | ~150 lines | ~840 lines |
Start building elegant web applications with the simplicity of functional JavaScript and Web Components.