Newsletter
Join the Community
Subscribe to our newsletter for the latest news and updates
Next.js template using Redis as a session store with NextAuth.js, supporting GitHub and Discord authentication.
Next.js Redis Session Store is an open-source Next.js starter template that demonstrates using Redis as a session store for NextAuth.js authentication, with GitHub and Discord providers pre-configured.
This template is a Next.js application built on the App Router that implements user authentication with NextAuth.js and stores session data in Redis instead of a traditional database. It takes environment variables for the Redis connection URL and OAuth client credentials as input and produces a working login flow with protected routes. The project is maintained by the redis-developer team and is designed for one-click deployment on Vercel with Redis Cloud.
REDIS_URL environment variable.GITHUB_CLIENT_ID and GITHUB_CLIENT_SECRET, then users can sign in via GitHub OAuth.The template uses NextAuth.js with a custom Redis adapter. When a user signs in, NextAuth writes session data to Redis and reads it on subsequent requests. Deployment on Vercel involves clicking the deploy button, creating a repository, adding Redis as a store (which sets REDIS_URL), and then configuring OAuth credentials in the Vercel dashboard.
Free and open source under the MIT License.
No, if you deploy with Vercel's Redis integration, the REDIS_URL environment variable is set for you. For local development, you set REDIS_URL=redis://localhost:6379 in your .env file.
To enable a provider, set both its client ID and client secret environment variables. To disable, remove or comment them out. The template reads these variables to build the NextAuth providers array.
Yes. Install the provider package if needed, update the NextAuth configuration in app/api/auth/[...nextauth]/route.js, and add the required environment variables. The README shows a Google provider example.
The project is open source under the MIT License, so it is free to use and modify.
The template provides npm run dev, npm run build, npm run start, and npm run lint for development, production build, production start, and code linting respectively.
