Create an Upstash account
Sign up for Upstash
Create a Redis database
Configure your database
Fill in the database details:
- Name: Choose a descriptive name (e.g.,
private-chat-prod) - Type: Select “Regional” for better latency
- Region: Choose a region close to where your application will be deployed
- TLS: Keep enabled for secure connections
If you’re deploying on Vercel, choose a region that matches your Vercel deployment region for optimal performance.
Get your credentials
Once your database is created, you need to copy your credentials.Find REST API section
Scroll down to the “REST API” section. You’ll see two important values:
- UPSTASH_REDIS_REST_URL
- UPSTASH_REDIS_REST_TOKEN
Add credentials to your project
Now that you have your credentials, you need to add them to your project.For local development
Create a.env.local file in your project root:
.env.local
For Vercel deployment
Add the environment variables in your Vercel project settings:- Go to your project in Vercel
- Navigate to Settings → Environment Variables
- Add both
UPSTASH_REDIS_REST_URLandUPSTASH_REDIS_REST_TOKEN - Select which environments they should be available in (Production, Preview, Development)
Free tier limits
Upstash offers a generous free tier that includes:- 10,000 commands per day
- 256 MB storage
- All regions available
- TLS encryption
You can monitor your usage in the Upstash console. If you exceed the free tier limits, consider upgrading to a paid plan.
Next steps
Now that you have your Upstash Redis database set up:- Learn about environment variables
- Deploy your app to Vercel