P2P Magnetic Poetry


Fridge Poetry


Building a shared fridge

Magnetic Fridge Poetry — a board scattered with word magnets

The best part of going to work is looking at the fridge to see what new fridge poetry has been made. So I made a version for the internet. The neat thing about this version though, is it's real time; it uses websockets to show other people moving words around.

The application is live HERE. It's a single shared board: open the page and you get the same scatter of words everyone else is looking at. Drag a word and everyone else watching sees it slide across their screen too.

How it's built

The backend is a small Go server using gorilla/websocket. There's one Board holding the magnet state (word, position, rotation, z-index) behind a mutex, and a Hub that fans out updates to every connected client. The wire protocol is two message types — move for dragging a single magnet and init for the initial snapshot or after a reset. When a client moves a magnet, the server bumps its z-index so the most recently touched word floats to the top, then broadcasts the new state to everyone else.

The word list lives in words.json so the vocabulary is easy to swap without touching the binary. Board dimensions are flag-configurable. The whole thing is small enough to run on a hobby box — which is the point; it's meant to live somewhere quiet and accumulate weird little poems.