# steveklabnik/request_store

Per-request global storage for Rack.

Repository: https://github.com/steveklabnik/request_store
Canonical: https://ross.abutalabs.com/products/request_store
Homepage: https://github.com/steveklabnik/request_store
Language: Ruby
License: MIT
License Family: permissive
Last push: 2024-05-01T20:21:45+00:00

## Health v2 (maintenance only)
Score: 23/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 0, release rhythm 8, longevity 100
- inputs: {"age_days": 5007, "days_push": 854, "days_rel": null, "gap_med": null, "n_releases_24m": 0}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 1500, forks 90 (observed 2026-08-28T04:04:54.160830+00:00)

## What it is
RequestStore is a Ruby gem providing per-request global storage for Rack applications, replacing error-prone Thread.current usage with request-scoped state that is cleared after each request. It ships as Rack middleware with a Rails Railtie and Sidekiq integration.

## Use cases
- store per-request state in Rails without Thread.current leaks
- share data like current_user across middleware and controllers
- avoid stale global state on threaded servers like Puma or Thin
- clear request-scoped variables between Sidekiq jobs
- memoize per-request values with RequestStore.fetch

## When to choose
- you need request-scoped global state in a Rack/Rails app
- Thread.current values leak across requests on threaded servers
- you want simple per-request memoization or context storage

## When to avoid
- you need distributed or persistent storage rather than in-process state
- you are not on Rack or a Rack-compatible framework
- you need state scoped to something other than an HTTP request or job

## Facets
- artifact type: library
- maturity: stable
- function: middleware, caching, web-framework
- domain: web-development, backend, developer-tools
- platform: ruby
- tags: rack-middleware, thread-local-storage, request-scoped-state, rails, sidekiq, web-server, rack

## Member repositories
- steveklabnik/request_store (main) score 23

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:04:54.160830+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T04:33:01.113593+00:00, confidence not recorded.
  - readme: https://github.com/steveklabnik/request_store (fetched 2026-08-28T04:04:54.160830+00:00, sha e9fc1dd3866a)
  - homepage: https://github.com/steveklabnik/request_store (fetched 2026-08-29T11:38:00.719367+00:00, sha 8ab390ac1034)
- Data as of 2026-08-30T08:39:29.467469+00:00.
