Skip to content
@nanoflakes

nanoflakes

little tiny snowflakes

Nanoflakes Logo

Nanoflakes

"Nanoflakes" is a specification for unique identifiers which can be generated locally or from a remote server. The specification is designed to be simple and easy to implement, and to be compatible with Twitter's Snowflake algorithm, which Nanoflakes is based on.

What's a Nanoflake?

A nanoflake is a 64-bit signed integer, and supports 1024 unique ID generators, each being able to generate 4096 (2^12) unique IDs per millisecond, and with 41-bit timestamps.

The main and only difference between a nanoflake and a Twitter Snowflake is that nanoflakes merges Twitter's 5-bit datacenter ID and 5-bit worker ID into a single 10-bit generator ID.

Additionally, the specification suggests encoding nanoflakes using base-36, in order to fit the largest possible nanoflake into a 13-character string.

The official, full specification can be found here.

Implementations

Nanoflakes have reference implementations in the following languages:

You're more than welcome to implement nanoflakes in other languages! If you do, please open a pull request to add your implementation to this list.

License

The official Nanoflakes specification is licensed under the CCO 1.0 Universal license.

The reference implementations are licensed under the MIT License.

Contributing

Contributions are welcome! Please open an issue or pull request to suggest changes to the specification or to add a new implementation.

Popular repositories

  1. .github .github Public

    GitHub repository for the Nanoflakes project.

    3

  2. nanoflakes-java nanoflakes-java Public

    Reference implementation of nanoflakes for Java.

    Java 3 1

  3. spec spec Public

    Official specification of the Nanoflakes identifier format.

    1 2

  4. nanoflakes-kotlin nanoflakes-kotlin Public

    Reference implementation of nanoflakes for Kotlin.

    Kotlin 1

  5. nanoflakes-js nanoflakes-js Public

    Reference implementation of nanoflakes for JavaScript.

    TypeScript

  6. nanoflakes-go nanoflakes-go Public

    Reference implementation of nanoflakes for Go.

    1

Repositories

Showing 6 of 6 repositories

Top languages

Loading…

Most used topics

Loading…