Redis Integration
Redis is a common infrastructure component in commercial projects, mainly used for caching, rate limiting, session storage, and other business-logic-related features.
The NEXTY.DEV boilerplate wraps Redis with a multi-provider abstraction and supports two modes out of the box:
- Upstash: REST API-based serverless Redis, compatible with Edge / Cloudflare Workers runtimes.
- ioredis: TCP-based self-hosted Redis, suitable for Node.js servers or Vercel deployments.
Select the provider via the DEFAULT_REDIS_PROVIDER environment variable (defaults to upstash). When the credentials for the selected provider are not configured, related features gracefully degrade without affecting other business logic.
Good to know The boilerplate includes a rate limiter example in the newsletter subscription feature that automatically decides whether to enable rate limiting based on your Redis configuration.
Select a Provider
| Provider | Use Case | Environment Variables |
|---|---|---|
upstash (default) | Serverless deployments, Edge / Cloudflare Workers | UPSTASH_REDIS_REST_URL, UPSTASH_REDIS_REST_TOKEN |
ioredis | Node.js servers, Vercel, self-hosted / Coolify Redis | REDIS_URL |
Upstash Configuration
-
Visit Upstash and register an account with your email
-
Go to the Dashboard page and click the
Create databasebutton



- Enter the database details page, and in the REST API module copy
UPSTASH_REDIS_REST_URLandUPSTASH_REDIS_REST_TOKENto your environment variables

- Make sure
DEFAULT_REDIS_PROVIDER=upstashor leave it unset (the default isupstash)
Self-Hosted Redis (ioredis) Configuration
-
Prepare a Redis instance. For local development use
redis://localhost:6379; for production you can use a managed Redis such as Coolify. See Coolify Redis deployment. -
Write the connection URL to
REDIS_URLand set the provider:
DEFAULT_REDIS_PROVIDER=ioredis
REDIS_URL=redis://localhost:6379Note ioredis depends on the Node.js
netmodule, so it does not work in Edge or Cloudflare Workers. Use the Upstash provider for those runtimes.
Verification
Now you can try submitting a newsletter subscription in the page Footer again:
- If using Upstash, check the Data Browser page in Upstash Redis. If there's new data, it means the subscription rate limiter is working.
- If using ioredis, verify the corresponding key with
redis-clior RedisInsight.

Secondary Development
Business code should import from lib/redis:
import { redis, checkRateLimit, getClientIPFromRequest } from "@/lib/redis";redis: unified Redis client providingget,set,incr,sadd,srem,sismember, etc.checkRateLimit: performs rate-limit checks based on the active provider (sliding window for Upstash, fixed window for ioredis).getClientIPFromRequest/getClientIPFromHeaders: retrieves the client IP.
When you need direct provider-native capabilities, export upstashRedis or ioRedis.