studds / nx-aws-example

Example repository for nx-aws
1 stars 2 forks source link

NestJS Example #2

Open nick-allen opened 4 years ago

nick-allen commented 4 years ago

Any example demonstrating packaging NestJS + dependencies? Have been struggling to sort out anything beyond this hello world example from this page and main package docs.

studds commented 4 years ago

If you're looking to run Nest using a serverful model (docker, k8s, ec2, heroku, whatever), then you want this: https://nx.dev/angular/plugins/nest/overview

If you're looking to run Nest inside of Lambdas, I'd caution you to think twice. Deploying a monolithic app in lambdas is getting towards an anti-pattern, and may prevent you from making the most of serverless architecture. Admittedly, it can be appealing because you're going to have such warm lambdas! On balance, though, I'm not convinced it's the right solution to cold starts.

This nx plugin is intended to be used on a microservices pattern, that is, one lambda per route / method combination. I'll admit to finding this unintuitive at first, however since adopting this pattern, I've never looked back.