Example Next.js project deployed on Vercel with AWS services for database, cron jobs and asynchronous jobs
Companion project of the article at https://dev.to/vvo/coding-the-jamstack-missing-parts-databases-crons-background-jobs-1bpj
This is a Next.js example coupled with AWS services to provide:
The goal is to have Next.js being deployed on Vercel, with resources being deployed on AWS via AWS Cloud Development Kit. The AWS stack is described and deployed via a single JavaScript file (infra/ExampleStack.js) thanks to AWS CDK's infrastructure as code (IaC) features.
This example provides local tools to replicate the AWS services in development mode.
yarn
yarn cdk deploy # first run can be long
This will deploy the services to AWS.
You need to add SECRET_AWS_ACCESS_KEY_ID
, SECRET_AWS_SECRET_ACCESS_KEY
and SECRET_AWS_REGION
to Vercel, see https://vercel.com/blog/environment-variables-ui on how to do it.
You can check in CloudWatch logs at https://console.aws.amazon.com/cloudwatch/home that your functions are called:
In local development, all you have to do is:
overmind start
By reading the Procfile This will start: