Lambda Store is a service that provides a managed Redis instance, providing high performance, low latency persistence for your app.
To get started, initialize the application locally with following command:
npx create-next-app --example with-redis with-redis-app
After initializing the app you can run it locally with the following command:
While your app will function well locally, there will be no persistence in the data. In step 2, you will create an API key which is required to connect the Lambda Store integration in step 4. This will enable data persistence for your app.
To create an API key, first create a new Lambda Store account here if you do not have one already.
After creating an account, select "Account" from the menu and click "API Keys" follwed by "Create An API Key".
Give your API key a name and confirm the creation - make a note of this key when shown as it will not visible again after this point.
In the next step, you will deploy the application initialized before shortly connecting it to the Lambda Store integration on Vercel.
To deploy your Next.js + Lambda Store app with a Vercel for Git Integration, make sure it has been pushed to a Git repository.
Import the project into Vercel using your Git Integration of choice:
After your project has been imported, all subsequent pushes to branches will generate Preview Deployments, and all changes made to the Production Branch (commonly "main") will result in a Production Deployment.
Once deployed, you will get a URL to see your app live, such as the following: https://roadmap-voting-demo.vercel.app/
Set up a Next.js + Lambda Store app with a few clicks using the Deploy button, and create a Git repository for it in the process for automatic deployments for your updates.
With your deployment made, install the Lambda Store integration from the Vercel Dashboard, adding a configuration for the account you imported your project to.
When prompted, enter the email address associated with your Lambda Store account along with your API key from step 2 and click "Setup".
Select the Project to add the database for and click "+ Add Database".
Provide a database name, type, and region before clicking "Create". Once the database has been created, click "Link to project" to provide the
REDIS_URL environment variable value to the Project.
From the next deployment created, the environment variable will be supplied to the app and you will have persistence provided by Lambda Store.