Vercel Integration
If you are using Vercel then you can integrate Upstash to your project easily. We believe Upstash is the perfect database for your applications thanks to its:
- Low latency data
- Per request pricing with monthly cap
- Durable storage
- Ease of use
Below are the steps of the integration.
#
Add Integration to Your Vercel AccountVisit Vercel Upstash Integration webpage and Click the Add
button. Choose your scope and application that you want to integrate.
#
Link DatabaseVercel will show you a popup window where you can sign in Upstash. Then you can create a database if you not have one.
Once you have a database, you will see the page where you can map a Upstash database to a Vercel app. After selecting the database and project, click on `Link Database`.
Now click on Complete on Vercel
, so the popup window will be closed and you will be forwarded to your Vercel page.
If you browse to your_application/settings/environment-variables
in Vercel dashboard, you will see the REDIS_URL has been set as environment variable.
You need to redeploy your app for the Environment Variable to be effective.
#
Create Your Redis ClientIf you completed the integration steps above and redeploy your app; the REDIS_URL environment variable will be accesible inside your Vercel application. You can create your client as below:
const Redis = require("ioredis");
module.exports = async(req, res) => {
let client = new Redis(process.env.REDIS_URL); await client.set('foo', 'bar'); let x = await client.get('foo');
res.json({ body: JSON.stringify("foo " + x) })}
#
SupportIf you have any issue you can ask in our Discord server or send email at support@upstash.com