Skip to content

Add multi-Redis support and production hardening#2

Open
c-stoeckl wants to merge 3 commits intoupstash:masterfrom
c-stoeckl:feature/multi-redis-support
Open

Add multi-Redis support and production hardening#2
c-stoeckl wants to merge 3 commits intoupstash:masterfrom
c-stoeckl:feature/multi-redis-support

Conversation

@c-stoeckl
Copy link

@c-stoeckl c-stoeckl commented Feb 1, 2026

Summary

This PR adds support for using standard Redis servers alongside Upstash Redis, along with several production hardening improvements:

  • Multi-Redis Support: New storage adapter architecture supporting both Upstash Redis and standard Redis servers via node-redis
  • Rate Limiter Fix: Corrected error handling for rate-limiter-flexible (throws RateLimiterRes objects, not Error instances)
  • TLS Support: Added REDIS_TLS_INSECURE option for self-signed certificates in private deployments
  • Error Handling: Added try/catch around storage operations for cleaner 500 error responses

Changes

  • api/index.ts - Fixed rate limit error detection, added try/catch for storage operations
  • src/storage/index.ts - New storage adapter factory
  • src/storage/types.ts - Storage adapter interface definitions
  • src/storage/redis.ts - Standard Redis adapter with TLS support
  • src/storage/upstash.ts - Upstash Redis adapter
  • .env.example - Documented new configuration options
  • README.md - Updated self-hosting documentation

Motivation

When self-hosting memo with a standard Redis server (common in private deployments), the existing Upstash-only implementation required workarounds. This PR enables native support for standard Redis servers while maintaining full backward compatibility with Upstash.

The rate limiter fix addresses an issue where rate limit responses were not being properly detected, causing 500 errors instead of proper 429 responses.

Test Plan

  • Verify existing Upstash Redis functionality works unchanged
  • Test with standard Redis server
  • Test with TLS-enabled Redis using self-signed certificates
  • Verify rate limiting returns proper 429 responses

c-stoeckl and others added 3 commits January 30, 2026 13:35
Introduced a StorageAdapter interface supporting both Upstash Redis
and standard open-source Redis. Users can now bring their own
self-hosted Redis via REDIS_URL or continue using Upstash.
- Add connection error handling with retry logic (maxRetriesPerRequest: 3)
- Add universal rate limiting for standard Redis via rate-limiter-flexible
- Add ping() health check method to StorageAdapter interface
- Use modern SET...EX instead of deprecated SETEX command
- Fix edge case where ttlSeconds=0 was treated as falsy
- Expose Redis client for rate limiting compatibility
- Update README with both Upstash and standard Redis options

Standard Redis users now have the same 60 req/min rate limiting
protection as Upstash users. Both adapters include health checks
for connection verification.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- Fix rate-limiter-flexible error handling (throws RateLimiterRes, not Error)
- Add try/catch around storage operations for clean 500 errors
- Add REDIS_TLS_INSECURE option for self-signed TLS certificates
- Update documentation with new TLS option

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@c-stoeckl c-stoeckl force-pushed the feature/multi-redis-support branch from 143cd07 to f9711ae Compare February 1, 2026 12:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant