Upstash Integration
Upstash is a serverless data infrastructure service that provides hosted Redis and Kafka services with low latency, high availability, and global distribution characteristics.
In complex commercial projects, Redis is usually essential, primarily used to implement caching, rate limiting, and other business logic-related features.
To meet different usage scenarios, the Nexty boilerplate encapsulates Redis and rate limiting with flexible compatibility:
- If Upstash environment variables are configured, it supports the encapsulated Redis and rate limiter methods
- If not configured, related features automatically degrade without affecting other business logic
To help you get started faster, the boilerplate includes a rate limiter example in the newslatter subscription feature that automatically determines whether to enable rate limiting based on Upstash configuration.
In this section, we'll complete Upstash registration and configuration.
Registration and Basic Configuration
-
Visit Upstash and register an account with your email
-
Go to the Dashboard page and click the
Create database
button



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

Verification
Now you can try submitting an newsletter subscription in the page Footer again, and check the Data Browser page in Upstash Redis. If there's new data, it means the subscription rate limiter is working.
