Figment Layered Environment Config
Compose application configuration with figment layers, joining TOML files with environment overrides and strict extraction.
Page 7 of 14
Compose application configuration with figment layers, joining TOML files with environment overrides and strict extraction.
Apply the governor quota-based limiter with per-key direct limiters, burst capacity, and 429 responses carrying retry timing.
Execute GraphQL queries from Rust with graphql-client, deriving response types from the query document and variables.
Render multi-stage CLI progress with indicatif: throttled bars, nested stages, log interception, and clean terminal restoration.
Chain iterator adapters to filter, map, and fold a collection lazily, expressing a transformation pipeline without intermediate vectors.
Sign and verify tokens with jsonwebtoken in Rust, validating registered claims, required fields, and clock tolerance windows.
Cache expensive computations with moka in Rust, combining TTL expiry with maximum size, entry metrics, and async loading.
Query large collections through the Rust MongoDB driver with server-side batching, cursor iteration, and aggregation pipelines.
Share mutable counters across threads with Arc for ownership and Mutex for exclusive access, avoiding data races at compile time.
Wrap primitives in newtypes so distinct identifiers and units cannot be mixed, adding validation and methods without runtime cost.
Parallelize CPU-bound aggregation with rayon par_iter, folding partitions independently and reducing partial results safely.
Manage redis-rs async connections with MultiplexedConnection, get_connection timeouts, and pubsub on a dedicated connection.
Subscribe to Redis pubsub channels with a dedicated connection, handling messages by channel name and resuming after drops.
Tune reqwest connection pooling with per-host keepalives, idle timeouts, and layered timeouts for connect, read, and total budgets.
Add retry to reqwest with retry-policies and tower middleware, restricting to idempotent methods and honoring Retry-After.
Return Result from functions and use the question-mark operator to propagate errors, keeping failure paths explicit and composable.
Derive Deserialize to load a configuration from JSON with defaults, rejecting unknown fields so typos in the config surface immediately.
Parse large JSON arrays incrementally with serde_json StreamDeserializer, yielding items as they arrive and isolating bad elements.
Write SQL with compile-time verification against a live PostgreSQL schema, keeping statements typed and migrations versioned.
Retry PostgreSQL serialization failures in sqlx transactions with bounded backoff, replaying the full unit on conflict only.
Model domain errors as thiserror enums with variant payloads, source chaining, and From conversions for ergonomic propagation.
Send messages from producer threads to a consumer over an mpsc channel, letting the receiver drain work without shared mutable state.
Bound async operations with tokio::select over a timeout future, racing work against deadlines and handling branch outcomes.
Cap concurrent tasks with a tokio semaphore through acquire_owned, applying per-key fairness and cleanup on cancellation.
Contain panics in spawned tasks with JoinHandle errors, replacing failed workers and distinguishing cancel from panic outcomes.
Race an async operation against a timer using tokio select!, so a slow future is abandoned cleanly when the deadline fires first.
Split a WebSocket stream into independent sink and stream halves, running concurrent send and receive loops with heartbeats.
Enrich tracing spans with structured field annotations, enter guards for synchronous sections, and follow-from causality links.
Bootstrap tracing with EnvFilter directives, JSON output in production, pretty console in development, and span lifecycle events.
Store heterogeneous implementations behind a Box dyn trait to select behaviour at runtime, trading monomorphisation for flexibility.
Remove duplicate natural keys and keep only the most recent row using a window function and a delete, a common cleanup before adding a unique constraint.
Diagnose slow queries with EXPLAIN ANALYZE and BUFFERS, reading scans, join strategies, and actual row estimates.
Find missing values in an id sequence by comparing each row with the previous one, a common data-integrity audit query.
Read an EXPLAIN plan to confirm whether a query uses the intended index and where a sequential scan or sort is introduced.
Paginate with the seek method on a compound cursor, comparing plans against OFFSET to show why deep pages stay fast.
Detect missing intervals in time series with LAG over generated series, then backfill gaps by carrying the last known value forward.
Compare two nullable columns without nulls silently dropping rows from a WHERE clause, using IS DISTINCT FROM instead of not-equal.
Implement classic offset pagination with a single-pass window count, page metadata, and sane caps on depth and page size.
Paginate with a WHERE clause on the last seen key instead of OFFSET, keeping each page fast and stable as new rows arrive.
Contrast string-interpolated SQL with parameterized statements, allowing safe dynamic ORDER BY through whitelisting.
Pivot monthly revenue by category using conditional aggregation, generating column lists dynamically for any date range.
Turn row values into columns with conditional aggregation, producing a wide report without a dedicated pivot operator.
Serialize critical sections across application instances with advisory locks, scoping by key and releasing on session end.
Index append-only time series with tiny BRIN blocks, comparing size against B-tree for range scans over billions of rows.
Aggregate rows into nested JSONB documents with jsonb_build_object and jsonb_agg, shaping API responses directly in SQL.
Query JSONB documents with containment operators backed by a GIN index, comparing jsonb_path_query for complex predicates.
Fetch the latest N rows per group with a LATERAL join driving an indexed subquery per outer row, avoiding giant windows.
Accelerate dashboards with materialized views, refreshing concurrently without blocking readers and tracking data staleness.
Index only live rows with a partial index over soft-deleted tables, keeping hot queries small and vacuum friendly.
Implement a database-backed sliding window rate limiter, atomically pruning old attempts and checking quota in one statement.
Implement atomic upserts with ON CONFLICT DO UPDATE, targeting partial unique indexes and guarding with WHERE conditions.
Explode product bills of materials with a recursive CTE, multiplying quantities down each assembly path and rolling up costs.
Walk a self-referencing employee table with a recursive CTE to list each person and their management depth from the top.
Walk employee hierarchies with a recursive CTE, tracking depth and reporting paths while avoiding cycles in malformed data.
Deduplicate rows keeping the newest per key with ROW_NUMBER, sweeping duplicates in one statement or blocking them upstream.
Compute a cumulative total per customer with a window frame, a pattern that replaces self-joins or application-side accumulation.
Claim a batch of jobs from a queue by locking only unlocked rows, letting concurrent workers drain the queue without blocking each other.
Insert a row or update it when the unique key already exists, in one atomic statement that avoids a race between read and write.
Compare RANK, DENSE_RANK, and ROW_NUMBER semantics on tied values, picking the right one for leaderboard and quota queries.
Compute per-account running balances with a window function ordered by transaction time, including partition isolation.
Classify async failures into retryable and fatal buckets, retrying only transient errors with backoff while surfacing permanent ones.
Map over large collections with bounded async concurrency, preserving input order in results and stopping early on failure modes.
A generic retry helper that preserves the resolved value type, caps attempts, and backs off between failures without losing type information.
Tag every log line with a request correlation id using AsyncLocalStorage, letting deeply nested async code log without passing context.
Attach a phantom brand to primitive types so structurally identical identifiers such as UserId and OrderId cannot be mixed up.
A builder that accumulates required fields in its type, refusing to compile a build call until every mandatory value has been supplied.
Parse multipart request bodies with Busboy in streaming mode, enforcing file count, size, and type limits before any bytes hit disk.
Validate transport objects with class-validator decorators and class-transformer, turning plain payloads into checked class instances.
Use a conditional type to relate a function's return type to its argument type, so passing an array yields an array result and a scalar yields a scalar.
Model variants as a union of objects sharing a literal tag and use a never-checked default to guarantee every case is handled.
Evolve a Drizzle PostgreSQL schema with generated SQL migrations, reviewing column additions as nullable first, then backfilling safely.
Type-safe joins with the Drizzle query builder against PostgreSQL, mapping result rows to inferred shapes and parameterizing every input.
Replace numeric enums with an as const object plus a derived union, giving readable runtime values and exhaustive compile-time checks.
Centralize Express error handling in TypeScript with a typed AppError hierarchy, status mapping, and an exhaustively narrowed middleware.
Extend Express request types through declaration merging so middleware can attach authenticated user data that later handlers read with full type safety.
Apply distributed rate limiting in Express with express-rate-limit backed by a Redis store, keying by user identity and API token.
Protect Fastify routes with the JWT plugin via preHandler guards, verifying tokens once and exposing typed claims to handlers.
Register a Zod type provider in Fastify so route schemas drive validation, serialization, and generated OpenAPI docs from one source.
Apply multi-document Firestore mutations atomically with admin SDK batched writes, checking batch size limits and ordering dependencies.
Declare overload signatures so one parser returns a typed object for structured input and a string for plain input, guiding callers precisely.
Wrap API payloads in a generic envelope type carrying status, data, and optional error metadata so clients get full inference from a single shape.
Define a repository contract parameterised by entity and id type, so different stores share one shape without duplicating method signatures.
Generate fully typed GraphQL document nodes with codegen, so queries, variables, and result shapes are checked before runtime execution.
Propagate per-call deadlines through gRPC clients with timeout headers, cancellation signals, and DEADLINE_EXCEEDED error classification.
Validate Hono route inputs with a Zod validator middleware that guards JSON bodies, returns field errors, and infers handler types.
Publish and consume Kafka topics with KafkaJS: keyed partitioning for order, consumer groups with manual commit, and graceful shutdown.
Build fully typed SQL with Kysely, from typed table definitions through dynamic where clauses to exactly shaped result row types.
Recursively make every property optional with a mapped type, the right shape for patch updates and nested test fixtures.
Cache expensive method results with a TTL decorator keyed by argument identity, tracking hit rates, and supporting explicit busting.
Attach a JSON schema to a Monaco editor model so invalid config keys are flagged inline, with hover docs and completion driven by the schema.
React to collection changes with a typed MongoDB change stream, filtering operations, resuming by token after restart, and cleaning up on close.
Validate Next.js server action input with Zod before any mutation, returning typed field errors for progressive enhancement without JS.
Contain server rendering failures in Next.js with route-level error boundaries, distinguishing retryable render errors from hard failures.
Instrument a Node service with OpenTelemetry tracing spans, nesting child spans across async boundaries and exporting OTLP batches.
Route Pino logs to multiple transports in parallel, sending errors to a dedicated sink while pretty console output stays development-only.
Run Playwright smoke flows inside a CI pipeline with a dedicated job, browser binary caching, retries for flaky steps, and artifact traces.
Use Prisma interactive transactions with serialization failure detection, bounded retry loops, and rollback on invariant violations.
Wire React Hook Form to a Zod resolver so field rules live in one schema, errors arrive per-field, and values stay typed through submit.
Make a nested configuration object deeply readonly so accidental mutation of shared settings fails at compile time rather than at runtime.
Define a recursive type for arbitrary JSON, then validate unknown input against it to safely walk nested structures without any.