Code Monkey home page Code Monkey logo

sinanbekar / turborepo-cdktf-microservices-app Goto Github PK

View Code? Open in Web Editor NEW
13.0 2.0 2.0 228 KB

(POC) Monorepo that includes serverless microservices using AWS Lambda and Amazon MQ (RabbitMQ) for backend, Vercel for frontend (Next.js) with Terraform CDK infrastructure.

Home Page: https://turborepo-cdktf-microservice-app.vercel.app/

JavaScript 15.32% Python 8.40% TypeScript 75.98% CSS 0.30%
aws lambda microservices serverless vercel bff nestjs nextjs python

turborepo-cdktf-microservices-app's Introduction

Turborepo CDKTF Microservices App

Monorepo using serverless microservices design with AWS Lambda and Amazon MQ (RabbitMQ) for backend, Vercel for frontend (Next.js) with Terraform CDK infrastructure.

What's inside?

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

Apps and Packages

  • csv-to-pdf-microservice: a python microservice that converts csv to pdf with RabbitMQ & kombu (messaging library)
  • aggregation: a Nestjs backend for frontend (Lambda function)
  • web: Next.js app
  • eslint-config-custom: eslint configurations (includes eslint-config-next and eslint-config-prettier)
  • tsconfig: tsconfig.jsons used throughout the monorepo

Notes

  • The infrastructure targets minimum cost (free) and does not include best practices for security. If you want to use it for large production you should create a VPC with private & public subnets with NAT Gateway (or VPC Endpoint PrivateLink) to establish a connection between API Gateway, Amazon MQ (set publicly accessible to false), STS, SecretsManager, and AWS Lambda. If you use VPC Endpoint (PrivateLink) for communication between these services, the traffic won't go on the public internet, it stays on AWS Network and this will help maximum security for your application.
  • Besides requests between microservice and frontend, the file sharing between Lambdas is provided with a message queue. (we are working with files less than 100 KB, and for staying free tier) You should not use a message queue for sharing file binary in large production, instead, you should use a reference path. For a serverless (AWS Lambda) environment, you can use EFS or S3. You can find additional information in application code comments.

Utilities

This turborepo has some additional tools already setup for you:

Setup

git clone https://github.com/sinanbekar/turborepo-cdktf-microservices-app
cd turborepo-cdktf-microservices-app
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:

turborepo-cdktf-microservices-app's People

Contributors

sinanbekar avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.