Jails.js Logo

A Lightweight JavaScript
Framework for Interactive Islands

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?

Built for the modern web

ƛ

Function Oriented

Functional, but in the Javascript way. Use the best of JavaScript's functional features to build clean, composable components.

🏝

Island Architecture

Small, focused chunks of interactivity within static and server-rendered web pages. Load only what you need.

JS Logo

Ecosystem Compatible

Integrate your application with any other JavaScript library easily. Works seamlessly with your existing stack.

100
FCP
LCP

Performance

Jails makes blazing-fast apps effortless—optimize page loads and deliver performance users notice. 🚀

Developer Experience

Simple by design

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.

app.js

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 Classic TodoMVC App Example

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

Ready to build with Jails.js?

Start building elegant web applications with the simplicity of functional JavaScript and Web Components.