bluetape-rs
Rust backend primitives for the bluetape ecosystem.

bluetape-rs is a new WIP repository. It is not a port of the Kotlin/JVM
bluetape4k libraries and it is not a rewrite of bluetape-go. The goal is to
provide Rust-native building blocks for backend services where compile-time
contracts, small native binaries, explicit error handling, and deterministic
integration tests matter.
Current Status
The current package scope is the corrective 0.3.1 workspace release. It
publishes the root facade and all focused foundation, collections, async, and
codec crates under the same version.
Completed foundation, 0.2.0, and 0.3.0 work stays narrow:
- define the workspace layout and release policy
- add general helper functions for typed validation errors, strings, and small numeric checks
- add logging and tracing support without forcing a global subscriber from library code, including scoped test capture helpers
- add reusable test helpers for async assertions,
MultithreadingTester,SuspendedJobTester, and temporary resource cleanup - add focused collection helpers and Tokio-first bounded task helpers for the
0.2.0line - add strict hex, Base64, Base58, Base62, and UTF-8 text boundary helpers for
the
0.3.0codec line - keep all APIs Rust-native instead of copying Kotlin extension APIs or Go package shapes
The 0.3.1 line publishes the whole current workspace. The codec scope adds
the explicit bluetape-rs-codec boundary for hex,
Base64, Base58, Base62, URL-safe encoding, and UTF-8 text/byte boundary
helpers. Compression, serialization, Testcontainers, SQL, resilience, and
leader election remain separate milestones so their dependency and runtime
costs stay explicit.
Intended Package Families
| Area | Working name | Purpose |
|---|---|---|
| Core | bluetape-rs-core |
Typed validation errors, validation helpers, string helpers, and small numeric checks. |
| Logging | bluetape-rs-logging |
Tracing setup helpers, structured fields, bounded correlation IDs, and scoped test capture. |
| Testing | bluetape-rs-test |
Async assertions, MultithreadingTester, SuspendedJobTester, temporary resources, and future Testcontainers boundaries. |
| Collections | bluetape-rs-collections |
Focused iterator, slice, map, grouping, chunking, and error-aware transform helpers. |
| Async | bluetape-rs-async |
Tokio-first bounded task execution, timeout/deadline, cancellation, and shutdown helpers. |
| Encoding | bluetape-rs-codec |
Base encoders, hex, URL-safe codecs, and small binary/text codec helpers. |
| Compression | bluetape-rs-compression |
Opt-in compression helpers and registry-style codec selection. |
| Serialization | bluetape-rs-serde |
Safe serializer/deserializer interfaces and test helpers around serde-compatible formats. |
| Testcontainers | bluetape-rs-testcontainers |
PostgreSQL, Redis, MySQL, NATS, Kafka, and emulator fixture helpers behind explicit features. |
| Leader | bluetape-rs-leader |
Redis, SQL, etcd, and Kubernetes Lease leader election. |
| SQL | bluetape-rs-sql |
SQL AST, dialect rendering, bind collection, typed query construction. |
| SQLx | bluetape-rs-sqlx |
SQLx executor, pool, transaction, migration, and repository adapters. |
| Resilience | bluetape-rs-resilience |
Retry, timeout, circuit breaker, bulkhead, backoff, and service policies. |
| AWS | bluetape-rs-aws |
Thin helpers around the official AWS SDK for Rust. |
| Audit | bluetape-rs-audit |
Snapshot, diff, outbox, and event-stream primitives inspired by audit workloads. |
| Graph | bluetape-rs-graph |
Graph model, bulk I/O, and backend adapters where Rust drivers are mature enough. |
| Text | bluetape-rs-text |
Aho-Corasick search, blockword masking, tokenizer wrappers, and language detection. |
| Workshop | bluetape-rs-workshop |
Runnable axum, Tokio, SQLx, Redis, AWS, graph, and text examples. |
Design Position
Rust should provide a different value proposition from the existing libraries:
- stronger type-level contracts for SQL, nullability, transaction scope, and dialect capabilities
- explicit
Result/Optionbased failure and absence handling Send/Syncaware concurrency boundaries- low runtime overhead and small deployable binaries
- Testcontainers-backed tests for infrastructure-facing packages
The first release should stay boring and broadly reusable: helpers, logging, and test support. Codec, compression, serialization, Testcontainers, and leader election should be split into separate milestones. Relational SQL should come after Testcontainers and before resilience. Leader election should come after SQL and resilience because Redis, RDB, etcd, and Kubernetes Lease support make it a larger multi-backend track. When SQL starts, its initial shape should be an inspectable SQL AST plus SQLx execution adapter, not a full ORM.
Using The Crates
The root facade enables only core by default. Enable optional facade modules
explicitly, or depend on the focused crates directly when you want a smaller
dependency surface.
[]
= { = "0.3.1", = ["logging", "codec"] }
[]
= { = "0.3.1", = ["test"] }
use ;
Focused crates use underscore import names:
[]
= "0.3.1"
= "0.3.1"
= "0.3.1"
= "0.3.1"
= "0.3.1"
[]
= "0.3.1"
use require_not_blank;
use CorrelationId;
use ;
use ;
use ;
use ;
use TempDir;
For collection helpers:
use ;
let page = with_meta.unwrap;
assert_eq!;
let chunks: = chunks.unwrap.collect;
assert_eq!;
For Tokio task and control helpers:
[]
= "0.3.1"
use Duration;
use ;
async
For codec helpers:
[]
= "0.3.1"
bluetape-rs-codec is the 0.3.1 crate boundary for strict hex, Base64,
Base58, Base62, URL-safe encoding, and UTF-8 text/byte boundary helpers.
Compression remains deferred to 0.4.0, and serde-oriented serialization
remains deferred to 0.5.0.
use ;
let bytes = ;
assert_eq!;
assert_eq!;
assert_eq!;
use ;
assert_eq!;
assert_eq!;
let token = encode_base64_url_unpadded;
assert_eq!;
assert_eq!;
Standard helpers use the + and / alphabet. URL-safe helpers use - and
_. Function names ending in _unpadded reject = padding during decode.
use ;
assert_eq!;
assert_eq!;
assert_eq!;
assert_eq!;
Base58 uses the Bitcoin alphabet and preserves leading zero bytes as 1.
Base62 uses 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
and preserves leading zero bytes as 0. This Base62 API is byte-oriented;
integer and UUID rendering can build on top of it later.
use ;
let token = encode_base64_url_unpadded;
assert_eq!;
let bytes = decode_base64_url_unpadded.expect;
assert_eq!;
assert_eq!;
decode_utf8_text rejects invalid UTF-8 with typed byte-position diagnostics.
Lossy replacement is available only through the explicitly named
decode_utf8_text_lossy helper. General string utilities, normalization,
compression registries, and serde-oriented serialization remain outside the
codec crate.
Codec public API tests live under crates/codec/tests/ so examples exercise
the same crate boundary that downstream users call. Source-local tests stay
limited to private implementation details.
Development
Project Management
Project Rules
- Keep APIs idiomatic to Rust.
- Do not mechanically port Kotlin/JVM or Go APIs.
- Prefer focused crates over a catch-all utility package.
- Add real container-backed smoke tests before claiming infrastructure support.
- Keep public documentation in English and maintain Korean README parity.