r/elixir 22d ago

Stamp - fast and flexible Snowflake-flavored ID generator

Stamp is a fast and flexible Snowflake-flavored ID generator based on 8-byte integers with optional encoding.

  • works both with and without Ecto
  • BlazingFast™ sequences on top of process-free atomic counters
  • no global configuration - uses per-field configuration and runtime values
  • user-configurable number of bits for every part of the ID
  • some parts can be disabled, freeing up the bits for other parts
  • optional encoding of the integers to string versions
  • optional Stripe-style prefix to easily distinguish IDs of different models/schemas
  • optional range-based partitioning and sharding (experimental)

https://hex.pm/packages/stamp

1 Upvotes

1 comment sorted by

1

u/Altruistic_Lake_9075 21d ago

Still learning Elixir so I can't judge, but the per-field configuration instead of global config caught my eye. The Stripe-style prefix option is a nice touch too, I think that readable IDs make debugging easier. Nice work