ferroid is a modular Rust workspace for generating and streaming time-sortable IDs, including Snowflake-style IDs and ULIDs.
This workspace includes:
ferroid
: Core ID types and generatorsferroid-tonic-core
: gRPC protocol definitions and shared typesferroid-tonic-server
: High-performance gRPC server that streams binary-packed ID chunks
The core library provides:
-
ID Types: Snowflake (
u64
,u128
), ULID (u128
) -
Custom Layout: macros to help build your own ID layout
-
Generators:
BasicSnowflakeGenerator
: single-threadedLockSnowflakeGenerator
: multi-threaded with lockingAtomicSnowflakeGenerator
: multi-threaded, lock-freeBasicUlidGenerator
: multi-threaded, high-entropy ULID generation
-
Async Support: Integrates with
tokio
andsmol
-
Encoding Support: Crockford base32 encoding/decoding for compact, sortable string IDs
This is the crate you'll typically depend on for ID generation.
Defines the gRPC protocol and shared types for ID streaming:
ferroid.proto
for ID stream requests and packed binary responses- Shared types used by both client and server
- Ensures type compatibility across deployments
ferroid-tonic-core
. If you're overriding the default ID
(SnowflakeTwitterId
), please fork this repo to ensure contract stability
between client and server.
A gRPC server for streaming IDs:
- Supports streaming chunked IDs
- Concurrent worker task pool with backpressure
- Graceful shutdown and stream cancellation
- Optional compression (
zstd
,gzip
,deflate
) - OpenTelemetry metrics and tracing
Run this to expose high-throughput ID generation as a network service.
cargo run -p ferroid-tonic-server --features tracing
Run all tests
cargo test --all-features
Run all benchmarks
cargo criterion --all-features
Licensed under either of:
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.