From 99d79b517e3bb9b6f3dd9f5c4f9bc788a76bf436 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Tue, 3 Feb 2026 04:02:45 +0000 Subject: [PATCH] docs: update versions to 0.1.275 and expand cookbook with new features - Update all documentation references to version 0.1.275 - Add `redis` and `postgres` backend examples to `rustapi-jobs` docs - Add comprehensive documentation for `rustapi-extras` features: - Observability (OpenTelemetry, Structured Logging) - Security (OAuth2, Security Headers, API Keys) - Resilience (Circuit Breaker, Retry) - Optimization (Caching, Deduplication) - Add "Enterprise Platform" learning path to cookbook Co-authored-by: Tuntii <121901995+Tuntii@users.noreply.github.com> --- docs/FEATURES.md | 4 +- docs/GETTING_STARTED.md | 18 +-- docs/PHILOSOPHY.md | 8 +- docs/README.md | 2 +- docs/cookbook/src/crates/rustapi_extras.md | 115 +++++++++++++++++- docs/cookbook/src/crates/rustapi_jobs.md | 38 ++++++ .../src/getting_started/installation.md | 4 +- docs/cookbook/src/learning/README.md | 19 +++ docs/cookbook/src/recipes/csrf_protection.md | 2 +- docs/cookbook/src/recipes/file_uploads.md | 2 +- docs/cookbook/src/recipes/http3_quic.md | 4 +- docs/cookbook/src/recipes/jwt_auth.md | 2 +- docs/cookbook/src/recipes/websockets.md | 2 +- docs/cookbook/src/troubleshooting.md | 2 +- 14 files changed, 196 insertions(+), 26 deletions(-) diff --git a/docs/FEATURES.md b/docs/FEATURES.md index 05f17e9..10055b9 100644 --- a/docs/FEATURES.md +++ b/docs/FEATURES.md @@ -1157,7 +1157,7 @@ RustApi::new() ```toml [dependencies] -rustapi-rs = { version = "0.1.4", features = ["full"] } +rustapi-rs = { version = "0.1.275", features = ["full"] } ``` | Feature | Description | @@ -1285,7 +1285,7 @@ let events = store.query() ### 1. Use `simd-json` (when available) ```toml -rustapi-rs = { version = "0.1.4", features = ["simd-json"] } +rustapi-rs = { version = "0.1.275", features = ["simd-json"] } ``` 2-4x faster JSON parsing. diff --git a/docs/GETTING_STARTED.md b/docs/GETTING_STARTED.md index 9a490b1..e2338e2 100644 --- a/docs/GETTING_STARTED.md +++ b/docs/GETTING_STARTED.md @@ -22,14 +22,14 @@ Add RustAPI to your `Cargo.toml`: ```toml [dependencies] -rustapi-rs = "0.1.233" +rustapi-rs = "0.1.275" ``` Or with specific features: ```toml [dependencies] -rustapi-rs = { version = "0.1.233", features = ["jwt", "cors", "toon", "ws", "view"] } +rustapi-rs = { version = "0.1.275", features = ["jwt", "cors", "toon", "ws", "view"] } ``` ### Available Features @@ -358,7 +358,7 @@ ApiError::internal("message") // 500 ### CORS ```toml -rustapi-rs = { version = "0.1.233", features = ["cors"] } +rustapi-rs = { version = "0.1.275", features = ["cors"] } ``` ```rust @@ -379,7 +379,7 @@ RustApi::new() ### JWT Authentication ```toml -rustapi-rs = { version = "0.1.233", features = ["jwt"] } +rustapi-rs = { version = "0.1.275", features = ["jwt"] } ``` ```rust @@ -409,7 +409,7 @@ async fn protected(user: AuthUser) -> Json { ### Rate Limiting ```toml -rustapi-rs = { version = "0.1.233", features = ["rate-limit"] } +rustapi-rs = { version = "0.1.275", features = ["rate-limit"] } ``` ```rust @@ -427,7 +427,7 @@ RustApi::new() ## TOON Format (LLM Optimization) ```toml -rustapi-rs = { version = "0.1.233", features = ["toon"] } +rustapi-rs = { version = "0.1.275", features = ["toon"] } ``` ```rust @@ -458,7 +458,7 @@ Response includes token counting headers: Real-time bidirectional communication: ```toml -rustapi-rs = { version = "0.1.233", features = ["ws"] } +rustapi-rs = { version = "0.1.275", features = ["ws"] } ``` ```rust @@ -495,7 +495,7 @@ websocat ws://localhost:8080/ws Server-side HTML rendering with Tera: ```toml -rustapi-rs = { version = "0.1.233", features = ["view"] } +rustapi-rs = { version = "0.1.275", features = ["view"] } ``` Create a template file `templates/index.html`: @@ -697,7 +697,7 @@ struct AnyBody { ... } Check that the `swagger-ui` feature is enabled (it's on by default): ```toml -rustapi-rs = { version = "0.1.233", features = ["swagger-ui"] } +rustapi-rs = { version = "0.1.275", features = ["swagger-ui"] } ``` ### CLI Commands Not Working diff --git a/docs/PHILOSOPHY.md b/docs/PHILOSOPHY.md index c9d51aa..bc764c6 100644 --- a/docs/PHILOSOPHY.md +++ b/docs/PHILOSOPHY.md @@ -72,7 +72,7 @@ We achieve this through: ```toml # Your Cargo.toml - simple and stable [dependencies] -rustapi-rs = "0.1" +rustapi-rs = "0.1.275" ``` You never write: @@ -111,13 +111,13 @@ validator = "0.16" ```toml # Just the basics -rustapi-rs = "0.1" +rustapi-rs = "0.1.275" # Kitchen sink -rustapi-rs = { version = "0.1", features = ["full"] } +rustapi-rs = { version = "0.1.275", features = ["full"] } # Pick what you need -rustapi-rs = { version = "0.1", features = ["jwt", "cors", "toon"] } +rustapi-rs = { version = "0.1.275", features = ["jwt", "cors", "toon"] } ``` | Feature | What You Get | diff --git a/docs/README.md b/docs/README.md index 33d68da..1477de3 100644 --- a/docs/README.md +++ b/docs/README.md @@ -32,7 +32,7 @@ RustAPI provides a stable, ergonomic public API. Internal dependencies (`hyper`, ```toml [dependencies] -rustapi-rs = "0.1.4" +rustapi-rs = "0.1.275" ``` ```rust diff --git a/docs/cookbook/src/crates/rustapi_extras.md b/docs/cookbook/src/crates/rustapi_extras.md index 7bf2ead..4da630b 100644 --- a/docs/cookbook/src/crates/rustapi_extras.md +++ b/docs/cookbook/src/crates/rustapi_extras.md @@ -89,7 +89,7 @@ The `insight` feature provides powerful real-time traffic analysis and debugging ```toml [dependencies] -rustapi-extras = { version = "0.1", features = ["insight"] } +rustapi-extras = { version = "0.1.275", features = ["insight"] } ``` ### Setup @@ -118,3 +118,116 @@ async fn get_insights(State(store): State>) -> Json Result<(), Box> { - **Redis**: High throughput persistence. Recommended for production. - **Postgres**: Transactional reliability (ACID). Best if you cannot lose jobs. +### Redis Backend + +Enable the `redis` feature in `Cargo.toml`: + +```toml +[dependencies] +rustapi-jobs = { version = "0.1.275", features = ["redis"] } +``` + +```rust +use rustapi_jobs::backend::redis::RedisBackend; + +let backend = RedisBackend::new("redis://127.0.0.1:6379").await?; +let queue = JobQueue::new(backend); +``` + +### Postgres Backend + +Enable the `postgres` feature in `Cargo.toml`. This uses `sqlx`. + +```toml +[dependencies] +rustapi-jobs = { version = "0.1.275", features = ["postgres"] } +``` + +```rust +use rustapi_jobs::backend::postgres::PostgresBackend; +use sqlx::postgres::PgPoolOptions; + +let pool = PgPoolOptions::new().connect("postgres://user:pass@localhost/db").await?; +let backend = PostgresBackend::new(pool); + +// Ensure the jobs table exists +backend.migrate().await?; + +let queue = JobQueue::new(backend); +``` + ## Reliability Features The worker system includes built-in reliability features: diff --git a/docs/cookbook/src/getting_started/installation.md b/docs/cookbook/src/getting_started/installation.md index f17447b..6ea9d02 100644 --- a/docs/cookbook/src/getting_started/installation.md +++ b/docs/cookbook/src/getting_started/installation.md @@ -30,14 +30,14 @@ cargo-rustapi --version If you prefer not to use the CLI, you can add RustAPI to your `Cargo.toml` manually: ```bash -cargo add rustapi-rs@0.1.233 +cargo add rustapi-rs@0.1.275 ``` Or add this to your `Cargo.toml`: ```toml [dependencies] -rustapi-rs = "0.1.233" +rustapi-rs = "0.1.275" ``` ## Editor Setup diff --git a/docs/cookbook/src/learning/README.md b/docs/cookbook/src/learning/README.md index 0c62412..654b5fb 100644 --- a/docs/cookbook/src/learning/README.md +++ b/docs/cookbook/src/learning/README.md @@ -106,6 +106,22 @@ Build AI-friendly APIs with TOON format and MCP support. --- +### 🏢 Path 5: Enterprise Platform + +Build robust, observable, and secure systems. + +| Step | Feature | Description | +|------|---------|-------------| +| 1 | **Observability** | Set up [OpenTelemetry and Structured Logging](../crates/rustapi_extras.md#observability) | +| 2 | **Resilience** | Implement [Circuit Breakers and Retries](../crates/rustapi_extras.md#resilience) | +| 3 | **Advanced Security** | Add [OAuth2 and Security Headers](../crates/rustapi_extras.md#advanced-security) | +| 4 | **Optimization** | Configure [Caching and Deduplication](../crates/rustapi_extras.md#optimization) | + +**Related Cookbook Recipes:** +- [rustapi-extras: The Toolbox](../crates/rustapi_extras.md) + +--- + ## 📦 Examples by Category ### Getting Started @@ -163,6 +179,9 @@ Find examples by the RustAPI features they demonstrate: | Rate Limiting | `rate-limit-demo`, `auth-api` | | WebSockets (`ws` feature) | `websocket`, `graphql-api` | | TOON (`toon` feature) | `toon-api`, `mcp-server` | +| OAuth2 (`oauth2-client`) | `auth-api` (extended) | +| Circuit Breaker | `microservices` | +| OpenTelemetry (`otel`) | `microservices-advanced` | | OpenAPI/Swagger | All examples | --- diff --git a/docs/cookbook/src/recipes/csrf_protection.md b/docs/cookbook/src/recipes/csrf_protection.md index 0108c03..71dac54 100644 --- a/docs/cookbook/src/recipes/csrf_protection.md +++ b/docs/cookbook/src/recipes/csrf_protection.md @@ -15,7 +15,7 @@ RustAPI's CSRF protection works by: ```toml [dependencies] -rustapi-rs = { version = "0.1", features = ["csrf"] } +rustapi-rs = { version = "0.1.275", features = ["csrf"] } ``` ```rust diff --git a/docs/cookbook/src/recipes/file_uploads.md b/docs/cookbook/src/recipes/file_uploads.md index 0234e3e..18504d3 100644 --- a/docs/cookbook/src/recipes/file_uploads.md +++ b/docs/cookbook/src/recipes/file_uploads.md @@ -6,7 +6,7 @@ Handling file uploads efficiently is crucial. RustAPI allows you to stream `Mult ```toml [dependencies] -rustapi = { version = "0.1", features = ["multipart"] } +rustapi = { version = "0.1.275", features = ["multipart"] } tokio = { version = "1", features = ["fs", "io-util"] } uuid = { version = "1", features = ["v4"] } ``` diff --git a/docs/cookbook/src/recipes/http3_quic.md b/docs/cookbook/src/recipes/http3_quic.md index c86e25a..2415513 100644 --- a/docs/cookbook/src/recipes/http3_quic.md +++ b/docs/cookbook/src/recipes/http3_quic.md @@ -8,9 +8,9 @@ HTTP/3 support is optional and can be enabled via feature flags in `Cargo.toml`. ```toml [dependencies] -rustapi-rs = { version = "0.1.9", features = ["http3"] } +rustapi-rs = { version = "0.1.275", features = ["http3"] } # For development with self-signed certificates -rustapi-rs = { version = "0.1.9", features = ["http3", "http3-dev"] } +rustapi-rs = { version = "0.1.275", features = ["http3", "http3-dev"] } ``` ## Running an HTTP/3 Server diff --git a/docs/cookbook/src/recipes/jwt_auth.md b/docs/cookbook/src/recipes/jwt_auth.md index f8359a1..14195ef 100644 --- a/docs/cookbook/src/recipes/jwt_auth.md +++ b/docs/cookbook/src/recipes/jwt_auth.md @@ -8,7 +8,7 @@ Enable the `jwt` feature in your `Cargo.toml`: ```toml [dependencies] -rustapi-rs = { version = "0.1", features = ["jwt"] } +rustapi-rs = { version = "0.1.275", features = ["jwt"] } serde = { version = "1", features = ["derive"] } ``` diff --git a/docs/cookbook/src/recipes/websockets.md b/docs/cookbook/src/recipes/websockets.md index 52b64af..f46b264 100644 --- a/docs/cookbook/src/recipes/websockets.md +++ b/docs/cookbook/src/recipes/websockets.md @@ -6,7 +6,7 @@ WebSockets allow full-duplex communication between the client and server. RustAP ```toml [dependencies] -rustapi-ws = "0.1" +rustapi-ws = "0.1.275" tokio = { version = "1", features = ["sync"] } futures = "0.3" ``` diff --git a/docs/cookbook/src/troubleshooting.md b/docs/cookbook/src/troubleshooting.md index 04d3821..9e61166 100644 --- a/docs/cookbook/src/troubleshooting.md +++ b/docs/cookbook/src/troubleshooting.md @@ -47,7 +47,7 @@ utoipa = "4.2" # ❌ Don't add this **Correct:** ```toml [dependencies] -rustapi-rs = { version = "0.1", features = ["full"] } +rustapi-rs = { version = "0.1.275", features = ["full"] } # rustapi-openapi is re-exported through rustapi-rs ```