Redis is often introduced as an in-memory cache, but it also supports data structures such as hash maps, counters, sorted lists, and queues. Lee uses it as the persistent store for a product roadmap where users can submit and upvote features.
Using Serverless Redis with Next.js
Lee Robinson of leerob demonstrates how to build and deploy a serverless Redis-backed product roadmap with Next.js and Upstash.
The example runs Next.js on Vercel and Redis on Upstash, with both services available on free tiers. Lee describes Upstash’s per-request pricing, spending caps, monitoring console, and GraphQL API. Vercel’s Upstash integration connects the services and adds the needed environment variables during deployment; the example deployment takes about 45 seconds.
The app connects to Redis through ioredis, configured with a connection string in an environment variable. Its homepage reads roadmap features in `getServerSideProps`, sorting them by score and then title. SWR starts with that server-fetched data and can revalidate it so updates, such as other users’ votes, appear without a full page refresh.
A feature form sends a POST request to a Next.js API route, which validates the title, limits its length, creates a UUID and other fields, and stores the feature in Redis. SWR updates the page cache immediately after submission. A separate form handles email subscriptions, while native HTML attributes provide required-field, email-type, autocomplete, and maximum-length validation.
Takeaways
- Redis can serve as a persistent application store, not only as a cache.
- Use managed serverless Redis and request-based pricing for a small app that may have variable traffic.
- Keep secrets in environment variables and connect services through deployment integrations where available.
- Combine server-rendered initial data with SWR revalidation for a page that feels current.
- Use Next.js API routes for lightweight backend operations, and native HTML validation for straightforward form checks.
Mentioned in this talk
Search inside this talk
What was claimed 11
- usescore_product
“the front end on Next.js on Vercel”
YouTube Verified5 sources· Talk, Job posting· archived
- featureUpstash: Per-request pricing with maximum caps
“per-request pricing with the serverless model”
YouTube Unverified1 source· Talk
- featureUpstash: Free tier
“they have a pretty generous free tier”
YouTube Unverified1 source· Talk
- featureUpstash: Serverless Redis deployment and management
“the easiest way I've found to deploy and manage a Redis instance”
YouTube Unverified1 source· Talk
- featureUpstash: GraphQL API
“There's also a GraphQL API I can use on top of that”
YouTube Unverified1 source· Talk
- featureUpstash: Durable Redis storage
“it allows you to use Redis for durable storage”
YouTube Unverified1 source· Talk
- integrates with
“You'll notice it has an Upstash integration included”
YouTube Unverified1 source· Talk
- integrates with
“connecting to our Redis instance”
YouTube Unverified1 source· Talk
Related talks
17:51
14:29
45:12
25:03
46:30
6:35