Type-safe, K-sortable, globally unique identifier inspired by Stripe IDs

This page summarizes the projects mentioned and recommended in the original post on news.ycombinator.com

InfluxDB - Purpose built for real-time analytics at any scale.
InfluxDB Platform is powered by columnar analytics, optimized for cost-efficient storage, and built with open data standards.
www.influxdata.com
featured
SaaSHub - Software Alternatives and Reviews
SaaSHub helps you find the best software and product alternatives
www.saashub.com
featured
  • ksuid

    K-Sortable Globally Unique IDs

    Assuming you don't need to use UUIDv7 (or any UUID's) then https://github.com/segmentio/ksuid provides a much bigger keyspace. You could just append a string prefix if you wanted to namespace, but the chance of collisions of a KSUID is many times smaller than a UUID of any version.

  • InfluxDB

    Purpose built for real-time analytics at any scale. InfluxDB Platform is powered by columnar analytics, optimized for cost-efficient storage, and built with open data standards.

    InfluxDB logo
  • typeid-sql

    SQL implementation TypeIDs: type-safe, K-sortable, and globally unique identifiers inspired by Stripe IDs

    That's how the type is encoded as a string, but type-safety ultimately comes from how the TypeID libraries allow you to validate that the type is correct.

    For example, the PostgresSQL implementation of TypeID, would let you use a "domain type" to define a typeid subtype. Thus ensuring that the database itself always checks the validity of the type prefix. An example is here: https://github.com/jetpack-io/typeid-sql/blob/main/example/e...

    In go, we're considering it making it easy to define a new Go type, that enforces a particular type prefix. If you can do that, then the Go type system would enforce you are passing the correct type of id.

  • typeid-go

    Go implementation of TypeIDs: type-safe, K-sortable, and globally unique identifiers inspired by Stripe IDs

    Thanks for the feedback!

    We have tests for the base32 encoding which is the most complicated part of the implementation (https://github.com/jetpack-io/typeid-go/blob/main/base32/bas...) but your point stands. We'll add a more rigorous test suite (particularly as the number of implementations across different languages grows, and we want to make sure all the implementations are compatible with each other)

    Re: prefix, is the concern that I haven't defined the allowed character set as part of the spec?

  • typeid

    Type-safe, K-sortable, globally unique identifier inspired by Stripe IDs

  • launchpad

    From Code to Kubernetes in One Step.

    typeid source: https://github.com/jetpack-io/launchpad/tree/main/pkg/typeid

    The linked repo is a CLI wrapper around this.

  • spec

    The canonical spec for ulid

    Many people had the same idea. For example ULID https://github.com/ulid/spec is more compact and stores the time so it is lexically ordered.

  • afid

    Neat, I like the type safe prefix idea.

    Personally, I rarely find I need ids to be sortable, so I just go with pure randomness.

    I also like to split out a part of the random section into a tag that is easier for me to visually scan and match up ids in logs etc.

    I call my ID format afids [0]

    [0] https://github.com/aJanuary/afid

  • SaaSHub

    SaaSHub - Software Alternatives and Reviews. SaaSHub helps you find the best software and product alternatives

    SaaSHub logo
  • brain

    Swyx's second brain! (by swyxio)

    for those researching this topic, I keep a list of these UUID/GUID implementations!

    https://github.com/swyxio/brain/blob/master/R%20-%20Dev%20No...

  • rust-ksuid

    A pure-Rust KSUID implementation

    We maintain a couple of popular ksuid libraries[1][2] and use it, so we definitely like ksuid. Though one big issue with ksuid is that being 160bit means that it doesn't fit into native uuid types in databases (e.g. postgres), which means that they come with a performance penalty.

    1: https://github.com/svix/rust-ksuid

  • python-ksuid

    A pure-Python KSUID implementation

  • saltpack

    a modern crypto messaging format

    There's more! I keep a list of interesting "bases" A select few:

    - base 58 - Satoshi's/Bitcoin's https://en.wikipedia.org/wiki/Binary-to-text_encoding#Base58

    - "base62" - Keybase's saltpack https://github.com/keybase/saltpack

    - The famous "Adobe 85" - https://en.wikipedia.org/wiki/Ascii85

    - basE91 - https://base91.sourceforge.net

    At work we defined several new "bases" for QR code. IMHO, it is an under applied area of computer science.

  • snowid

    A Decentralized, K-Ordered 128-bit Unique ID Generator library in C.

    This looks really interesting! I recently wrote[1] a pure C (no external dependency) version of coordination free, k-ordered 128-bit UUID Generator library which is inspired by snowflake but has bigger key space and few nifty features to protect against clock skew etc. The 128 bits are split into {timestamp:64, worker_id:48, seq: 16} where the seq if id is requested within the same millisecond.

    [1] - https://github.com/beyonddream/snowid

  • js-id

    ID generation for JavaScript & TypeScript Applications

    We have a uuidv7 implementation that we've been using with rocksdb for over a year https://github.com/matrixai/js-id

  • typeid-ts

    TypeID UUIDv7 implementation in Typescript (Lib and CLI)

  • ulid

    Universally Unique Lexicographically Sortable Identifier (ULID) in Go

    There is no "tests".

    There is just a single test. Which only tests the decoding of a single known value. No encoding test.

    Go has infrastructure for benchmarking and fuzzing. Use it!

    Also, you took code from https://github.com/oklog/ulid/blob/main/ulid.go which has "Copyright 2016 The Oklog Authors" but this is not mentionned in your base32.go.

  • resource-id

    Developer-friendly k-sortable IDs

    I have a thin JavaScript package published which generates type-prefixed KSUIDs. KSUID is a great format assuming you can spare the extra bits (which is most people)

    [1] https://github.com/sophiabits/resource-id

  • SaaSHub

    SaaSHub - Software Alternatives and Reviews. SaaSHub helps you find the best software and product alternatives

    SaaSHub logo
NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts

  • Type-safe, K-sortable, globally unique identifier inspired by Stripe IDs

    1 project | news.ycombinator.com | 26 Aug 2024
  • TypeID: Type-safe, K-sortable, globally unique identifiers

    1 project | news.ycombinator.com | 28 Jul 2024
  • TypeID-JS: Type Safe, K-Sortable Unique IDs for Javascript

    4 projects | dev.to | 9 Jul 2024
  • You'll regret using natural keys

    5 projects | news.ycombinator.com | 5 Jun 2024
  • ULIDs and Primary Keys

    1 project | news.ycombinator.com | 12 Apr 2024

Did you konow that Go is
the 4th most popular programming language
based on number of metions?