On a lark, I built a website that does nothing more or less than report the number of people who are currently on that very website: heylookat.us
What does this site do, exactly? The number is how any people are currently on the site.
Ok but why? It’s a meditation on the specious community of the Internet and the alienating loneliness of self-reference in a time of…oh who am I kidding. Basically just because I had the idea and couldn’t let it go.
How does it work? See the next section, or view and remix the code on Glitch (see the embed above).
Where does “hey look at us” come from? It’s a meme.
The stack for this site is Node, Fastify, and Redis on the backend and regular old HTML/CSS/JS on the frontend. No third-part tracking scripts. It’s hosted on Glitch.
The app works as follows: Current visitors are recorded in Redis. On initial page loads the server responds with the number of visitors currently active. The browser immediately begins polling the server for updates at an interval of 5 seconds.
If this is the visitor’s first time on the site, the polling endpoint will create a UUID for the client and the client will store the UUID in local storage. Future polling requests will include this UUID in a custom header.
Once the polling endpoint has a UUID—either by grabbing it from the request headers or by generating it—it sets a Redis key with the visitor’s UUID. These visitor keys have a TTL of 10 seconds and future requests refresh this TTL. It then counts up the number of visitor keys that are currently active and responds with this count. The client then updates the DOM with the new count.
Hope you get a tiny bit of joy out of this very silly little site. A fun thing to do is to share it with a group (your Twitter followers, a Slack workspace, your group chat) and watch the number go up. This probably shouldn’t be as satisfying as it is.
Update: i’m here for me.
After I launched this site, a friend suggested it would be fun if in addition to a site that tells you how many people are on it I also built a site that only lets one person on at a time. “Haha,” I thought. But then I couldn’t get the though out of my head. So, I built imherefor.me, which does exactly that.