Skip to content

Latest commit

 

History

History
79 lines (55 loc) · 2.4 KB

File metadata and controls

79 lines (55 loc) · 2.4 KB

Turborepo example Terraform CDK infrastructure with AWS and Vercel deployments

Nextjs deployment on Vercel, Serverless API (Express) deployment on AWS Lambda, Terraform CDK infrastructure, monorepo example.

What's inside?

This turborepo uses pnpm as a packages manager. It includes the following packages/apps:

Apps and Packages

  • api: a Express API (Lambda function)
  • docs: a Next.js app
  • web: another Next.js app
  • ui: a stub React component library shared by both web and docs applications
  • eslint-config-custom: eslint configurations (includes eslint-config-next and eslint-config-prettier)
  • tsconfig: tsconfig.jsons used throughout the monorepo

Utilities

This turborepo has some additional tools already setup for you:

Setup

git clone https://github.com/sinanbekar/turborepo-terraform-cdk-aws-vercel
cd turborepo-terraform-cdk-aws-vercel
pnpm install

Build

To build all apps and packages, run the following command:

pnpm run build

Deployment

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

Develop

To develop all apps and packages, run the following command:

pnpm run dev

Useful Links

Learn more about Terraform and CDK for Terraform:

Learn more about the power of Turborepo: