UPID – a unique ID with built-in prefix
The discussion about what to use for database keys has come up a few times on HN. Integers or UUID, or maybe ULID/UUIDv7 with a time component. One that also comes up is prefixes (as used by Stripe, most famously). The biggest downside (imo) of the Stripe approach is that you either have to store them as strings, which isn't great, or strip/prepend in your API layer. So I made a new thing called UPID. It's most similar to ULID, as it includes a time-component (but with lower precision) and also encodes to a base32 alphabet. But it also includes a 20-bit prefix (allowing four…
What it does
In the maker’s words, at launch
The discussion about what to use for database keys has come up a few times on HN. Integers or UUID, or maybe ULID/UUIDv7 with a time component. One that also comes up is prefixes (as used by Stripe, most famously). The biggest downside (imo) of the Stripe approach is that you either have to store them as strings, which isn't great, or strip/prepend in your API layer. So I made a new thing called UPID. It's most similar to ULID, as it includes a time-component (but with lower precision) and also encodes to a base32 alphabet. But it also includes a 20-bit prefix (allowing four characters). So it can be stored as a UUID or anywhere a 128-bit blob goes, and it always knows what its prefix is because it's baked in. I've made implementations for Python, Rust and TypeScript, as well as a Postgres extension (with a upid datatype). Mentioned it a few weeks ago in a HN discussion and people seemed pretty interested so thought I'd post it as a submission. In Rust it looks like this: use upid::Upid; Upid::new("post"); // post_2acqyme2ygscyguveuhj5a There are more examples in the repositories. Repo (Python, Rust, Postgres): https://github.com/carderne/upid TypeScript: https://github.com/carderne/upid-ts Demo site: https://upid.rdrn.me/
Does the same job
all alternatives →More dev tools this month
the category →



Open-source GTM skills for technical founders
Dev tools · 29d ago · gtmcofounder.com

OpenTrailPaper is open-source bike computer firmware for the LilyGO T5S3 4.7" E-Paper PRO. It supports offline maps, GPX routes, FIT recording and Bluetooth sensors.
Dev tools · 2d ago · opentrailpaper.com

Launched alongside, August 2024
the whole month →
- IY
Life & fun · 2024 · ytch.xyz



- IA
Hey there HN! We’re Joe and Stopa, and today we’re open sourcing InstantDB, a client-side database that makes it easy to build real-time and collaborative apps like Notion and Figma. Building modern apps these days involves a lot of schleps. For a basic CRUD app you need to spin up servers, wire up endpoints, integrate auth, add permissions, and then marshal data from the backend to the frontend and back again. If you want to deliver a buttery smooth user experience, you’ll need to add optimistic updates and rollbacks. We do these steps over and over for every feature we build, which can…
Dev tools · 2024 · github.com