Nextjs deployment on Vercel, Serverless API (Express) deployment on AWS Lambda, Terraform CDK infrastructure, monorepo example.
This turborepo uses pnpm as a packages manager. It includes the following packages/apps:
api: a Express API (Lambda function)docs: a Next.js appweb: another Next.js appui: a stub React component library shared by bothwebanddocsapplicationseslint-config-custom:eslintconfigurations (includeseslint-config-nextandeslint-config-prettier)tsconfig:tsconfig.jsons used throughout the monorepo
This turborepo has some additional tools already setup for you:
- TypeScript for static type checking
- ESLint for code linting
- Prettier for code formatting
git clone https://github.com/sinanbekar/turborepo-terraform-cdk-aws-vercel
cd turborepo-terraform-cdk-aws-vercel
pnpm installTo build all apps and packages, run the following command:
pnpm run buildTo deploy frontend to Vercel, backend to AWS (Lambda), first install cdktf-cli:
pnpm add --global cdktf-cli@latest
cd infrastructure/cdktf
cdktf get # generate constructs from hcl providersPlease make sure that set up these environment variables: AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY and VERCEL_API_TOKEN
and deploy 🚀
cdktf deploy backend frontendTo develop all apps and packages, run the following command:
pnpm run devLearn more about Terraform and CDK for Terraform:
Learn more about the power of Turborepo: