Redis Compatible Database
Upstash is a serverless database platform that offers different products, including Redis, QStash and Vector database.
Upstash Redis: Upstash provides a serverless database service that is compatible with the Redis API.
Upstash QStash: QStash is a serverless messaging and scheduling solution provided by Upstash. It is designed to easily integrate into existing workflows and help developers build reliable systems without managing infrastructure.
Upstash Vector: Upstash Vector is a serverless vector database designed for working with vector embeddings. It's essential for managing numeric representations of objects (like images, sounds, text) in a multi-dimensional space.
Start by connecting to your existing project and then run vercel link in the CLI to link to the project locally. If you are starting fresh, you can use our Next.js template.
Run vercel env pull .env.development.local to make the latest environment variables available to your project locally.
Run the following command to install the Upstash Redis SDK:
npm install @upstash/redisYou can find more details and documentation on the Upstash Redis SDK for TypeScript.
To start using the SDK in your project, import the client and use it in your API endpoint:
import { Redis } from '@upstash/redis';import { NextResponse } from 'next/server';
// Initialize Redisconst redis = Redis.fromEnv();
export const POST = async () => { // Fetch data from Redis const result = await redis.get("item"); // Return the result in the response return new NextResponse(JSON.stringify({ result }), { status: 200 });};Start by connecting to your existing project and then run vercel link in the CLI to link to the project locally. If you are starting fresh, you can use our Nuxt template.
Run vercel env pull .env.development.local to make the latest environment variables available to your project locally.
Run the following command to install the Upstash Redis SDK:
npm install @upstash/redisYou can find more details and documentation on the Upstash Redis SDK for TypeScript.
To start using the SDK in your project, import the client and use it in your API endpoint:
import { defineEventHandler } from "h3";import { Redis } from "@upstash/redis";
// Initialize Redisconst redis = Redis.fromEnv();
export default defineEventHandler(async () => { // Fetch data from Redis const result = await redis.get("item"); // Return the result in the response return { result };});Start by connecting to your existing project and then run vercel link in the CLI to link to the project locally. If you are starting fresh, you can use our SvelteKit template.
Run vercel env pull .env.development.local to make the latest environment variables available to your project locally.
Run the following command to install the Upstash Redis SDK:
npm install @upstash/redisYou can find more details and documentation on the Upstash Redis SDK for TypeScript.
To start using the SDK in your project, import the client and use it in your API endpoint:
import { KV_REST_API_URL, KV_REST_API_TOKEN } from "$env/static/private";import { json } from '@sveltejs/kit';import { Redis } from '@upstash/redis';
// Initialize Redisconst redis = new Redis({ url: KV_REST_API_URL || "", token: KV_REST_API_TOKEN || ""});
export async function POST() { // Fetch data from Redis const result = await redis.get("item"); // Return the result in the response return json({ result });};It will set the required environment variables which will be used by your project.
*** Redis is a trademark of Redis Ltd. Any rights therein are reserved to Redis Ltd. Any use by Upstash is for referential purposes only and does not indicate any sponsorship, endorsement or affiliation between Redis and Upstash.