---
title: "Get Started with Upstash Vector & Next.js"
description: "A simple example to demonstrate Upstash Vector with Next.js."
url: "https://vercel.com/templates/next.js/get-started-with-upstash-vector-and-next-js"
links:
  repository: "https://github.com/upstash/vector-js/tree/master/examples/nextjs"
  demo: "https://vector-nextjs.vercel.app"
  deploy: "https://vercel.com/new/clone?demo-title=Get+Started+with+Upstash+Vector+%26+Next.js&demo-description=A+simple+example+to+demonstrate+Upstash+Vector+with+Next.js.&demo-url=https%3A%2F%2Fvector-nextjs.vercel.app&project-name=Get+Started+with+Upstash+Vector+%26+Next.js&repository-name=get-started-with-upstash-vector-and-next-js&repository-url=https%3A%2F%2Fgithub.com%2Fupstash%2Fvector-js%2Ftree%2Fmaster%2Fexamples%2Fnextjs&skippable-integrations=1&stores=%255B%257B%2522integrationSlug%2522%253A%2522upstash%2522%252C%2522productSlug%2522%253A%2522upstash-vector%2522%252C%2522type%2522%253A%2522integration%2522%257D%255D&demo-image=%2F%2Fimages.ctfassets.net%2Fe5382hct74si%2F2wLqXeJZBsJWCUOO52UHs6%2Fea312f6b93bc5f89fcad6bb0af3c207c%2Fvector-landing-page.png"
---

# Get Started with Upstash Vector & Next.js

A simple example to demonstrate Upstash Vector with Next.js.

# Upstash Vector & Next.js Example

In this example, you can find how you can use Upstash Vector with Next.js.

The client is initialized in `/src/app/api/route.ts` folder like:

```ts
import { Index } from "@upstash/vector";

const index = new Index({
  url: process.env.UPSTASH_VECTOR_REST_URL,
  token: process.env.UPSTASH_VECTOR_REST_TOKEN,
})

export const GET = async () => {
  // ...
}
```

## Local Development

First, install the dependencies with:

```
npm install
```

Then, create a `.env.local` file and fill the environment variables:

```
UPSTASH_VECTOR_REST_URL="***"
UPSTASH_VECTOR_REST_TOKEN="***"
```

Finally, run:

```
npm run dev
```

## Deployment

You can deploy with:

```
npm run deploy
```

Then, set the environment variables in your project, redeploy and start using the app on Vercel!

## Related Templates

### [Next.js Boilerplate](https://vercel.com/templates/next.js/nextjs-boilerplate)

Get started with Next.js and React in seconds.

### [Upstash Vector + Vercel AI SDK Starter](https://vercel.com/templates/next.js/upstash-vector-vercel-ai-sdk-starter)

A RAG chatbot starter for expert answers on university degrees. Built using Vercel AI SDK, LangChain, Upstash Vector, and OpenAI.

---

## Additional documentation

The [Vercel Knowledge Base](https://vercel.com/kb) contains guides and answers to common questions about Vercel, including deployment, framework configuration, domains, caching, and troubleshooting.
