connect-redis

Redis-backed session store for Express and Connect apps, built on express-session's Store interface.

Library
npm
v10.0.0
2,823 stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
65 /100 Good
Development Activity 52
Maintenance 32
Community 76
Maturity 60
Momentum 40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation. How we score it →
64 /100 Good
Architecture 78
Code Quality 74
Innovation 80
Learning Curve 25

connect-redis is a lightweight, single-purpose adapter that plugs Redis into express-session’s Store interface, giving Express applications persistent, shared session storage instead of the default in-memory store. It wraps a user-supplied node-redis client (standalone or cluster) and implements the full Store contract — get, set, destroy, touch, clear, length, ids, and all — with configurable TTL, key prefixing, and serialization.

Maintained by TJ Holowaychuk’s connect-redis project since 2010, it remains one of the most widely used session backends in the Node.js ecosystem, with the current major version targeting modern node-redis clients and current Node.js runtimes. It supports cluster-aware key scanning, dynamic TTL callbacks, and pluggable serializers, without bundling Redis as a direct dependency — the store is constructed once by the caller and handed straight to express-session.

What You Get

  • A drop-in express-session Store implementation backed by Redis (standalone or Cluster clients)
  • Automatic TTL management synced to the session cookie’s expiration, plus a custom TTL callback option
  • Cluster-aware key scanning (SCAN) for ids(), all(), length(), and clear() across sharded Redis deployments
  • Configurable key prefixing and pluggable serialization (defaults to JSON, swappable for custom encoders)

Common Use Cases

  • Sharing session state across multiple Express server instances behind a load balancer
  • Persisting sessions through server restarts and deploys instead of losing them with an in-memory store
  • Isolating session keyspaces for multiple apps sharing one Redis instance via key prefixes
  • Scaling session storage horizontally with Redis Cluster as traffic grows

Under The Hood

Architecture connect-redis is a single-class, single-file library: RedisStore extends express-session’s Store base class and implements the full storage contract (get/set/destroy/touch/clear/length/ids/all) directly against a Redis client the caller constructs and passes in. There’s no internal layering beyond that — each method computes a prefixed key, issues one or two Redis calls, and funnels results and errors through a shared callback helper that supports both promise-based and legacy Node-style callback consumers. Cluster support lives in a private scan-iterator method that detects a cluster-typed client at runtime and fans a SCAN out across every cluster node, otherwise delegating to the client’s own scan iterator. The design has no adapter layer insulating it from express-session’s Store contract, but that contract has been stable for a long time, keeping the practical coupling risk low.

Tech Stack The implementation is TypeScript in strict mode, targeting a modern ECMAScript version with bundler-style module resolution. The Redis client and express-session are both peer dependencies installed by the consumer rather than bundled, keeping the package thin. Builds run through Vite with a dts plugin to emit both ESM and CJS outputs alongside hand-copied type declaration files. Linting and formatting use a Rust-based toolchain in place of ESLint/Prettier, and tests run under Vitest with coverage reporting. CI runs the full lint, build, and test pipeline against a real, locally spawned Redis server across a matrix of current Node.js versions on every push and pull request.

Code Quality Tests are integration-style rather than mocked unit tests: a real Redis server process is spawned for the suite and every Store method is exercised against it, including a bulk load/clear pass, though the cluster-scanning branch itself has no dedicated automated coverage. Error handling is consistent across every method — Redis calls are wrapped in try/catch and errors are threaded through the shared callback helper so promise and callback consumers get identical error semantics without duplicated logic. Strict TypeScript settings catch unused locals and implicit-return bugs at compile time; the one meaningful type-safety compromise is an any-typed client option that is narrowed immediately inside the constructor. Naming is short and idiomatic, matching express-session’s own conventions. CI enforces type-checking, linting, formatting, and tests before merge.

API Design The public surface is a single exported class constructed with one options object and handed straight to express-session’s store option — genuinely minimal boilerplate to get started. Every method transparently supports both promise-based and legacy Node callback calling conventions via a shared helper, so it drops into either style without extra adapter code. Standalone-versus-cluster Redis clients are detected automatically at runtime, so callers don’t need a separate class or flag for Redis Cluster deployments. The configuration options (ttl, prefix, serializer, disableTTL, disableTouch, scanCount) map directly onto Redis-native concepts, keeping the mental model close to Redis itself rather than introducing new abstractions.

Used by 8 apps in this directory

TypeScript
62%
Other

Flowise

AI Development · Automation · Developer Tools

55,490

Drag-and-drop visual builder for AI agents, RAG pipelines, and multi-agent systems—deploy anywhere in minutes.

View details
82
Repo Health
77
Technical
63
Dependency
Built with
TypeScript 62%
JavaScript 27%
Updated 1 months ago
TypeScript
83%
Apache 2.0

Grist

Databases · No Code Platforms

11,875

A modern relational spreadsheet that combines Python-powered formulas, drag-and-drop dashboards, and granular access controls in a self-hostable, SQLite-backed data platform.

View details
91
Repo Health
93
Technical
66
Dependency
Built with
TypeScript 83%
Python 11%
Updated 5 days ago
TypeScript
97%
Other

Infisical

Devops · Security

29,468

The open-source platform for secrets, certificates, privileged access, and AI agent security — all in one self-hostable system.

View details
91
Repo Health
84
Technical
65
Dependency
Built with
TypeScript 97%
Updated 4 days ago
TypeScript
82%
MIT

LibreChat

AI Assistants · Developer Tools

45,009

Unite every major AI model in one self-hosted chat platform with agents, code execution, MCP tools, and enterprise authentication.

View details
93
Repo Health
81
Technical
65
Dependency
Built with
TypeScript 82%
JavaScript 17%
Updated 4 days ago
TypeScript
88%
MIT

medusa

Ecommerce

36,494

The most flexible open-source commerce platform — build B2C, B2B, and marketplace applications with modular, composable commerce primitives.

View details
93
Repo Health
87
Technical
63
Dependency
Built with
TypeScript 88%
JavaScript 12%
Updated 1 weeks ago
JavaScript
88%
GPL 3.0

NodeBB

Community

15,227

Modern Node.js forum software with real-time WebSockets, multi-database support, and a plugin ecosystem — the community platform built for the open web and the Fediverse.

View details
97
Repo Health
78
Technical
70
Dependency
Built with
JavaScript 88%
Go Template 11%
Updated 4 days ago
JavaScript
64%
AGPL 3.0

overleaf

Collaboration · Productivity

18,188

Open-source, real-time collaborative LaTeX editor with sandboxed compilation and full TeXLive support for self-hosted academic and research teams.

View details
87
Repo Health
80
Technical
62
Dependency
Built with
JavaScript 64%
TypeScript 30%
Updated 2 weeks ago
TypeScript
82%
Other

twenty

CRM

57,585

The open-source CRM you build, ship, and version like the rest of your stack — with customizable objects, AI agents, and a TypeScript SDK.

View details
92
Repo Health
82
Technical
64
Dependency
Built with
TypeScript 82%
MDX 15%
Updated 4 days ago

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers