
This Next.js project demonstrates how to use Redis as a session store for authentication. The application supports multiple authentication providers, offering a scalable and performant solution for your web applications.
Follow these steps to deploy your application with Redis Cloud on Vercel:
REDIS_URL environment variable.Install dependencies:
Run the development server:
Open http://localhost:3000 in your browser to see the application.
Ensure you have a Redis server running and configure the connection in your .env file:
Note: If you deployed using Vercel with Redis Cloud, this will be automatically set for you.
Configure authentication providers by setting or omitting their respective environment variables in your .env file:
CLIENT_ID and CLIENT_SECRETCLIENT_ID and CLIENT_SECRETGITHUB_CLIENT_ID and GITHUB_CLIENT_SECRETExample:
Discord
DISCORD_CLIENT_ID and DISCORD_CLIENT_SECRETExample:
To add more authentication providers:
app/api/auth/[...nextauth]/route.jsExample for adding Google provider:
For more information on adding and configuring providers, refer to the NextAuth.js documentation on providers.
Generate a secure NEXTAUTH_SECRET:
Add this to your Vercel project's environment variables as NEXTAUTH_SECRET.
This application leverages Redis for efficient session data storage, offering:
npm run dev: Run the app in development modenpm run build: Build the app for productionnpm run start: Start the production buildnpm run lint: Run linting on the codebaseExplore these resources to deepen your understanding:
We welcome contributions! If you have ideas, suggestions, or encounter issues, please open an issue or submit a pull request.
This project is open source and available under the MIT License.


