Blogs
Notes on frontend engineering, the browser, and the backend behind it.
No posts yet.
The secret life of this number
Your browser checks its notes. Is site:visit-counted in localStorage? Then you're already in.
First time? One letter. POST /api/visits. After that, only GET, which just reads the number.
A tiny function wakes up. A Cloudflare Pages Function takes the request.
D1 does the maths. count = count + 1, in one row of SQLite.
No cookies, no IP, no ID. A new browser counts as a new visitor, so this is a friendly estimate.
Notes on frontend engineering, the browser, and the backend behind it.
No posts yet.