Kitten

A 💕 Small Web development kit.

Free as in freedom, small as in Small Technology.

Kitten is still a baby. Expect breaking changes until API version 1.

Get started

System requirements
  • Linux and macOS.
  • Bash version 5.x+.
  • Common developer tools and system utilities (git, tar, tee, and xz).

Install

Latest version released last Thursday at 3:43 PM UTC (view source).

Run the following command in a terminal window (or, use curl):

    wget -qO- https://kittens.small-web.org/install | bash
    
    
  

Play

Kitten, uniquely, enables you to build Small Web apps (peer-to-peer web apps). But it also aims to make creating any type of web app as easy as possible. Before embarking on the Tutorials from the beginning, let’s jump right in at the deep end and create a simple app using Kitten’s Streaming HTML workflow.

The ubiquitous counter example

  1. Create a directory for the example and enter it:

    mkdir counter
    cd counter
    
  2. Create a file called index.page.js and add the following content to it:

    if (kitten.db.counter === undefined) kitten.db.counter = { count: 0 }
    
    export default () => kitten.html`
      <page css>
      <h1>Counter</h1>
      <${Count} />
      <button name='update' connect data='{value: -1}' aria-label='decrement'>-</button>
      <button name='update' connect data='{value: 1}' aria-label='increment'>+</button>
    `
    
    const Count = () => kitten.html`
      <div
        id='counter'
        aria-live='assertive'
        morph
        style='font-size: 3em; margin: 0.25em 0;'
      >
        ${kitten.db.counter.count}
      </div>
    `
    
    export function onUpdate (data) {
      kitten.db.counter.count += data.value
      this.send(kitten.html`<${Count} />`)
    }
    
  3. Run Kitten using the following syntax:

    kitten
    

In the video, you see a slighty older and more verbose way of adding an event handler. Going forward, you should prefer the method shown in the code example here.

Once Kitten is running, hit https://localhost, and you should see a counter at zero and two buttons.

Press the increment and decrement buttons and you should see it count update accordingly.

Press Ctrl C in the terminal to stop the server and then run kitten again.

Refresh the page to see that the count has persisted.

In two dozen lines of liberally-spaced code, you have built a very simple web application that:

Now you have some idea of what to expect, let’s slow down and start from the beginning with the tutorials. As you’ll see, the Streaming HTML workflow shown above is just one streamlined way of working with Kitten.

Kitten is designed in a progressively enhanced manner so that it will serve static HTML sites and traditional web sites written in HTML, CSS, and JavaScript, as well as peer-to-peer Small Web sites and ones that make sure of the special enhancements that Kitten provides to make web development simple and fun again.

Like this? Fund us!

Small Technology Foundation is a tiny, independent not-for-profit.

We exist in part thanks to patronage by people like you. If you share our vision and want to support our work, please become a patron or donate to us today and help us continue to exist.