Getting started with Kitten, a kit for the Small Web

Kitten turns a folder of HTML, CSS and JavaScript into a website or web app, with HTTPS, a built-in database and peer-to-peer features for the Small Web. What it is, who it’s for, and how to go from install to a live app.
Getting started with Kitten, a kit for the Small Web

Kitten is a small web server and development kit that turns a folder of HTML, CSS and JavaScript files into a website or a web app. Drop an index.html in a folder, type kitten, and it’s live at https://localhost, with a real HTTPS certificate. Write a .page.js file instead and that’s a dynamic page. One more line saves the data in a database that’s already built in. Something shows up on the screen without a build step, a config file or a framework to learn first.

It’s made by the Small Technology Foundation, a tiny not-for-profit, and it’s free software under the AGPL 3.0. The source lives on Codeberg.

What the “Small Web” part means

Kitten calls itself “a Small Web development kit”, and that name explains who it’s for.

Most of the web today is what the people behind Kitten call the Big Web: a few huge platforms where millions of people live inside one company’s servers, under that company’s rules. The Small Web is the opposite idea. Each person has their own small place on the web, a site or app that belongs to one person, runs on their own domain, and talks directly to other people’s places.

Kitten is built for that. It can serve a plain static site like any web server, but it also comes with things that normally need gluing together by hand: a database, sessions, WebSockets, authentication and public key cryptography, for peer-to-peer apps where two Small Web places talk to each other directly.

Who it’s for

Kitten is a good fit if you:

  • know some HTML, CSS and JavaScript and want to build something without learning React, a bundler and a cloud platform first;
  • want a personal site or a small app that you own and host yourself;
  • like the idea of an app that belongs to one person, like a private guestbook, a chat between two people or a tool just for you;
  • are teaching or learning web development and want students to see results in minutes.

It’s probably the wrong pick for serving millions of users from one app, for a “serverless” deploy, or for a client project that needs stability today. The project says itself that Kitten “is still a baby” and that breaking changes will come until API version 1.

What it needs

Kitten runs on Linux and macOS. It needs Bash 5 or newer and a few common tools: git, tar, tee and xz. Most Linux distributions already have all of them.

On macOS, keep in mind that the Bash that comes with the system is the old 3.2 version, so a newer one is needed (Homebrew’s bash package works).

For running a site in production, only Linux with systemd is supported.

Installing

The quickest way is to pipe the installer into Bash:

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

To avoid running scripts straight from the internet (fair), clone the repository, read the install script and run it yourself:

git clone https://codeberg.org/kitten/app kitten
cd kitten
./install

Check that it worked with kitten --version. Later, kitten update updates it and kitten uninstall removes it along with its data, after asking first.

A first page

Create a folder with a single HTML file in it:

mkdir kitten-playground
cd kitten-playground
echo “

Hello from Kitten

” > index.html
kitten

Now open https://localhost in the browser and the page is there.

Notice there’s no certificate warning. On its first run, Kitten creates a local certificate authority and adds it to the system’s trust store (and to Firefox and Chrome, if they’re installed), so the machine serves real HTTPS in development, just like a server would in production. The operating system asks for permission before that.

kitten with no arguments serves the current folder. It also takes a path, like kitten ~/sites/blog. To stop the server, press Ctrl+C.

A page that does something

Rename index.html to index.page.js and replace its content with this:

let count = 1

export default () => kitten.html`

Kitten count

\({'🐱'.repeat(count++)}

\` Run

Write a comment