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

2026-10-26来源 dev.to WebDevEnglish
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!

👉 catcloud.party

原文:https://www.a8q9.cn/en/article/i-built-a-little-social-site-with-zero-npm-dependencies-and-a-cat-runs-it-11bfbb.html

相关文章