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 bothweb
anddocs
applicationseslint-config-custom
:eslint
configurations (includeseslint-config-next
andeslint-config-prettier
)tsconfig
:tsconfig.json
s 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 install
To build all apps and packages, run the following command:
pnpm run build
To 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 providers
Please 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 frontend
To develop all apps and packages, run the following command:
pnpm run dev
Learn more about Terraform and CDK for Terraform:
Learn more about the power of Turborepo: