Kitten

Make your first static ā€œHello, world!ā€ Kitten page using plain old HTML.

Topics covered

Let’s quickly create and test your first ā€œHello, world!ā€ Kitten site.

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

    mkdir kitten-playground
    cd kitten-playground
    
  2. Create a file called index.html and add the following content to it:

    <h1>Kitten</h1>
    <p>šŸ±ļø</p>
    
  3. Run Kitten using the following syntax:

    kitten
    

Once Kitten is running, hit https://localhost, and you should see your new site.

šŸ’” When you run kitten without any arguments, it defaults to serving the current directory. You can also specify a path as the first argument (kitten [path to serve]) to serve a different directory than the one you’re currently in.

šŸ’” Notice that you didn’t get a certificate error. This is because Kitten automatically creates a development-time TLS certificate for your local machine signed by a local certificate authority that it adds to your system’s trust store (and to Firefox, if you have it installed) using Auto Encrypt Localhost.

(If you’re running on Windows under WSL 2 and you do get a certificate error, please remember to manually install the local development certificates in your browsers.)

šŸ’” You’re not limited to accessing your local machine via https://localhost. You can also use any local IP address that it’s accessible from (see Accessing your local machine from other devices on your local area network for more information). You can also use the IP aliases 127.0.0.2 - 127.0.0.4 and localhost aliases (subdomains) place1.localhost - place4.localhost without certificate errors. The latter, especially, are useful when testing the peer-to-peer features of Small Web apps.

šŸ’” Small Web places made with Kitten are meant to be owned and used by one person. Until an identity and secret has been generated for this person, Kitten will display a link to the special page that generates them. (Your secret on a Small Web place never hits the server.) You can also generate this secret from Kitten’s REPL using the .id create command.)

šŸ’” By default, Kitten will be as quiet as possible and only surface warnings and errors. If you want more extensive logging, start it with the VERBOSE environment variable set:

VERBOSE=true kitten [path to serve]

Similarly, if you want to see performance statistics, set PROFILE=true.

Note that the first time Kitten is run, it will create a TLS certificate authority and add it to your system trust stores as well as to Firefox and Chrome so you can run your development environment from https://localhost to match the deployment environment as closely as possible. Your operating system will ask your permission before allowing this.

So we’ve seen how Kitten happily serves any HTML you throw at it just like any good web server should.

But you can render HTML using any old web server…

Let’s start doing things no other web server can do, shall we?

Next tutorial: Dynamic Pages

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.