Upstash is a serverless data platform. It gives you Redis and Kafka as a service, with a pricing model that charges per request instead of per server. If you have ever wanted Redis in a small project but did not want to run and maintain a Redis server, Upstash is built for exactly that situation.
How does it work? You create a database in the Upstash console, and you get an HTTP endpoint and a token. Instead of keeping a persistent TCP connection open, you send your commands over HTTP, which fits perfectly with serverless functions that spin up and shut down constantly.
# Create a key with the REST API curl -X POST https://your-db.upstash.io/set/visits/1 \ -H "Authorization: Bearer YOUR_TOKEN"
# Read it back curl https://your-db.upstash.io/get/visits \ -H "Authorization: Bearer YOUR_TOKEN"
Enter fullscreen mode
Exit fullscreen mode
// Or use the official client in your app import { Redis } from '@upstash/redis' ;
const redis = new Redis ( { url : process . env .…