← All writing

My corner of the internet is a pixel room

nani.is-a.dev is a tiny pixel-art room with a computer in it. Click the screen and it boots into a whole pretend desktop, and everyone visiting at the same time shows up in the room.

·2 min read
The nani-os desktop at night: a start menu, a piano app and a sudoku window, over a pixel city with a full moon.

Most personal sites are a page you scroll. I wanted one you could walk into.

nani.is-a.dev is a tiny pixel-art room with a computer in it. Click anything for a little line about it, double-click to step inside it, drag the furniture around. Click the computer’s screen and the camera zooms in, the machine boots, and you’re on nani-os, a whole pretend desktop.

What’s in the room

It grew a lot. Today the room has:

  • 129 things to click, and 62 views and mini-games to step into: the toy train becomes a train-driving game, the pinball table is a real pinball game, the old beige computer runs a text adventure
  • a cat that naps and climbs its tree, a robot vacuum that goes home to charge, rain and lightning
  • day, golden hour or night, following your own clock

And on the computer:

  • 21 games and 20+ apps, with windows, a start menu and files with right-click
  • a terminal with 60+ commands
  • nanoweb, a pretend internet with a 157-article wiki and 25+ pixel-art sites
  • nani.fm, a radio with lofi, live chiptune loops and rain
  • 162 trophies to collect

Pinball in the room: flippers, bumpers and a NANI planet in the middle of the table.

Everything is drawn in code

There isn’t a single image file for the art. Every piece of furniture, every game and every icon is drawn with code. There’s no framework, no build step and no dependencies either: the browser loads plain JavaScript and that’s it.

That sounds like a strange choice, but it made the room easy to change. Moving the desk or recolouring the walls is a number in the code, not a trip to an image editor, and every visitor can make the room their own (walls, floor, lamp colour, the neon sign’s text, the cat’s colour), and it is all saved.

You’re not alone in there

Everyone visiting at the same time shows up in the room as a little pixel character, one of 28 kinds, each with friendly phrases.

That part runs on Cloudflare. One Durable Object holds every visitor’s WebSocket. It uses the Hibernation API, so when the room is quiet, it costs nothing. Each page pings every 25 seconds; a visitor whose page goes quiet for 3 minutes (a closed laptop, a lost network) becomes a ghost, and the room sends them away.

Locked down

A site full of apps and games is a lot of code running in your browser, so it’s strict about what that code may do:

  • a Content-Security-Policy that starts from default-src 'none' and allows only the site’s own scripts, styles, fonts and socket
  • Trusted Types required, so text can’t sneak into the page as HTML
  • no framing, no referrer, and sensor and device APIs switched off

359 tests keep it all honest.

Come and visit

nani.is-a.dev. Bring a friend: you’ll see each other in the room.