UP

UPID – a unique ID with built-in prefix

Hacker News

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 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/

Share card

Actual performance

5points
3comments
Did not reach leaderboard

Launch Intel predictions

Analyze your own launch →
Product HuntOn track for Day 1 leaderboard · Strong signals: stripe, new, code · Missing: mac, agents, macos
76%76% predicted probability of success on Product Hunt, based on ML models trained on real launch data.
best fitHighest predicted score across all platforms for this description.
Hacker NewsStrong engagement from HN community · Strong signals: ide, io · Missing: https docs, excited, just released
62%62% predicted probability of success on Hacker News, based on ML models trained on real launch data.
nativeThis product was originally launched on this platform.
Indie HackersIH features products with proven revenue · Missing: supports, reddit linkedin, podcasting
47%47% predicted probability of success on Indie Hackers, based on ML models trained on real launch data.
TrustMRRLess likely to generate early MRR · Strong signals: way · Missing: mobile apps, ios, personal
35%35% predicted probability of success on TrustMRR, based on ML models trained on real launch data.
AppSumoMay struggle as an AppSumo deal · Missing: plus, platform, intuitive
34%34% predicted probability of success on AppSumo, based on ML models trained on real launch data.
Acquire.comPre-revenue stage for this audience · Missing: arr, mrr, revenue
14%14% predicted probability of success on Acquire.com, based on ML models trained on real launch data.
BetaListMay not resonate with beta-testers · Missing: web3, chat, crypto
0%0% predicted probability of success on BetaList, based on ML models trained on real launch data.

Incorrect prediction on native model

Similar products

K-
K-ordered unique id in decentralised manner for Go39%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

K-ordered unique id in decentralised manner for Go

Hacker News3
XI
XID – Dependency-Free Unique ID Generator in One C File54%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

XID – Dependency-Free Unique ID Generator in One C File

Hacker News7
So
Sonyflake – distributed unique ID generator implemented in Rust57%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Sonyflake – distributed unique ID generator implemented in Rust

Hacker News66
Fl
FlocBloc: Obfuscate Your FLoC ID43%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

FlocBloc: Obfuscate Your FLoC ID

Hacker News2
Fl
FlocBloc: Obfuscate Your FLoC ID43%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

FlocBloc: Obfuscate Your FLoC ID

Hacker News5
Fl
FlocBloc – Obfuscate/Spoof your FLoC cohort id43%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

FlocBloc – Obfuscate/Spoof your FLoC cohort id

Hacker News5
Fl
FlocBloc – Obfuscate/Spoof your FLoC cohort id43%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

FlocBloc – Obfuscate/Spoof your FLoC cohort id

Hacker News1
Pe
Petition against national id in U.K43%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Petition against national id in U.K

Hacker News1
Lochness.id
Lochness.id30%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Prrrotect yourrr brrrand. No more fakesss or impersonatorrs!

Product Hunt+14
ih
ihwan․id43%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.
TrustMRR3$14/moMobile Apps