Task 8 - #52
Open
skyisnotmylimit wants to merge 5 commits into
Open
Conversation
…stgreSQL - Created CDK project in infra/ directory - Added Lambda function with NodejsFunction construct - Configured API Gateway REST API with CORS support - Added RDS PostgreSQL database instance in VPC - Implemented TypeORM entities for Cart and CartItem models - Added database configuration with AWS Secrets Manager support - Updated CartService to use TypeORM repositories - Configured environment variables for Lambda deployment Task 8: AWS deployment infrastructure
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Task 8 — NestJS Cart Service on AWS Lambda + RDS (PostgreSQL)
Task 8.1 — Lambda + API Gateway
src/lambda.ts— serverless entrypoint that bootstraps NestJS via@codegenie/serverless-expressand exposes ahandlerfor Lambdainfra/— standalone CDK project (separate from the NestJS app) containing:NodejsFunction(Node 20.x) pointing atsrc/lambda.tsRestApiwith a catch-all proxyLambdaIntegrationrouting all HTTP methods to the Lambdahttps://jncym2xiu8.execute-api.us-east-1.amazonaws.com/prod/Task 8.2 — RDS PostgreSQL + VPC + Security Groups
DatabaseInstanceusingPostgresEngineVersion.VER_16_3,t3.micro, placed in private subnetsTask 8.3 — TypeORM Cart + CartItem Models + DB Integration
Entities:
cartsidUUID PK,user_idvarchar not null,statusenum (OPEN/ORDERED)cart_itemsidUUID PK,cart_idFK →carts.id,product_idvarchar not null,countintService changes:
CartServicefully rewritten from in-memory storage to async TypeORM repository patternProductCatalogServiceadded — fetches product details from the product service by ID to preserve the{ product, count }response shape expected by the frontendORDEREDinstead of deleting the rowEnvironment variables:
DB_HOST,DB_PORT,DB_USER,DB_PASSWORD,DB_NAME,DB_SSL,DB_SYNC) injected into Lambda via CDKenvironmentpropertyPRODUCT_SERVICE_URLconfigurable via CDK context flag-c productServiceUrl=...apiPaths.tsupdated to use the deployed cart API URL (overridable viaVITE_CART_SERVICE_URL)Deployement