DEV Community

Cole
Cole

Posted on

I built a little social site with zero npm dependencies (and a cat runs it)

I've been building catcloud, a small corner of the internet where everyone gets their own page to decorate, kind of like old GeoCities/MySpace pages. It's run by Tuft, a purple pixel cat who is officially the CEO. He writes memos.

You get a page at catcloud.party/@yourname that you can paint however you want: colors, layouts, pictures, or raw HTML/CSS. There are guestbooks, a mini pixel cat on every page that visitors can pet and feed, trading cards, a small arcade, and a live hangout room where everyone's mini cats walk around together.

Here's how it's built, because a few parts were fun to figure out.

Zero dependencies
The whole thing runs on plain Node 22: node:http for the server and the built-in node:sqlite for the database. There's nothing in node_modules, no framework, and no build step. The frontend is plain JavaScript too.

Hosting it for free
It runs on the Cloudflare Workers free plan. The whole app lives inside one SQLite-backed Durable Object, so it's still "one server with one database", just on someone else's computer. The same code also runs on a normal PC with npm start.

Letting people write raw HTML safely
People can put their own HTML and CSS on their page. To make that safe, each page renders inside a sandboxed iframe with a strict Content-Security-Policy and no scripts allowed. That way someone's page can look however they want, but it can't run code or touch anyone's account.

Pixel art without image editors
Most of the art (game sprites, furniture, cat clothes) is drawn as little text grids in JavaScript, where each letter is a color. The browser turns them into outlined pixel sprites at 4x. It's a lot easier to tweak a hat when the hat is a string.

Games that are hard to cheat
The arcade pays out coins, so people would want to cheat it. The server picks every round from a seed, then re-checks the results when you finish: it replays the round and checks that you didn't move faster than the game allows. If the numbers don't add up, no coins.

A live room on a free plan
The hangout room uses Server-Sent Events. To keep traffic tiny, the cats' walking paths come from a shared seed, so the server only sends "this cat did something" events, never positions. Every browser works out where each cat is on its own.

Try it
It's free and still new, so it's pretty quiet right now. If you make a page, drop your link in the comments and I'll sign your guestbook. I'd love feedback on what's confusing or broken!

👉 https://catcloud.party

Top comments (4)

Collapse
 
susanacharya profile image
Susan Acharya •

the sandboxed iframe with a strict CSP for raw html pages is a neat way to keep it safe. and drawing the pixel art as text grids is such a fun constraint. does the live hangout room run on the same durable object?

Collapse
 
yupthatscole profile image
Cole • • Edited

thanks!! yep, same one. the whole site lives in a single durable object, hangout included. the room’s state just lives in memory, so if the object restarts the room empties out, which is fine for a hangout. everyone gets one SSE stream, capped at 40 people for now. because the cats’ paths come from a shared seed, the server mostly sends tiny “this cat waved” events instead of positions, so it stays cheap on the free plan. the only thing that actually writes to the database is tossing someone’s cat a treat.

Collapse
 
susanacharya profile image
Susan Acharya •

single durable object holding the whole room is a nice setup. the shared seed so the server only sends 'this cat waved' events is smart, way cheaper than streaming positions. curious how it holds up when you hit the 40 cap

Thread Thread
 
yupthatscole profile image
Cole •

honestly, it hasn’t hit 40 yet lol. the cap is mostly there to be safe. if you join when it’s full, the server just says “the room’s full. tuft says wait outside.” and you can try again in a bit. if it ever does fill up regularly, the plan would be splitting into multiple rooms, each with its own durable object, so nothing has to stream to everyone. for now one room is plenty. come hang out if you want!