Wereflake is a high-performance server designed to generate unique Snowflake IDs efficiently and reliably using the /snowflake endpoint. Snowflake IDs are 64-bit integers that provide globally unique identifiers with chronological ordering, making them ideal for distributed systems and scalable architectures.
The 64-bit Snowflake ID is composed of the following fields:
+---------------+---------------+---------------+---------------+
| 1 bit | 41 bits | 10 bits | 12 bits |
+---------------+---------------+---------------+---------------+
| Unused | Timestamp | Machine ID | Sequence |
+---------------+---------------+---------------+---------------+
| Field | Bits | Description |
|---|---|---|
| Unused | 1 | Reserved bit, always set to 0; ensures the ID is positive. |
| Timestamp | 41 | Milliseconds since a custom epoch; ensures chronological ordering. |
| Machine ID | 10 | Unique identifier for the machine or node generating the ID. |
| Sequence | 12 | Incrementing counter within the same millisecond to prevent collisions. |