It generates ids consisting of a 41 bit time (millisecond precision with custom epoch)
followed 23 random bits. Result is a Buffer with an added feature of base58 and
base10 conversions for producing compact and readable strings.
The generated IDs are generally compatible (in time) with IDs generated
by other Simpleflake implementations as long as the same epoch is used.
Simpleflake by design is an un-coordinated solution to the same problem
solved by coordinated solutions like Twitter Snowflake.
ID collisions in practice will likely be a rare occurrence, but should be
anticipated when integration this service.
Application developers that are able to embed a well-tested Simpleflake library
within their codebase should consider that approach prior to deploying
this network service to save on network round-trips.
The following examples show the available endpoints:
curl http://localhost:3000/v1 (returns a base10 ID) curl http://localhost:3000/v1/base58 (returns a base58 ID) curl http://localhost:3000/v1/hex (returns a hex ID)
Within your application, make a HTTP GET request to return a new ID in the response
body. Different endpoints provide different encodings.
A status endpoint is available at
/health_check to verify service availability.
In a production environment, this service can be placed behind an HTTP load