Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documenting the internals/how this works (for Pulumi implementation) #72

Closed
vha14 opened this issue Mar 8, 2021 · 7 comments
Closed
Labels
question Question about usage of the library

Comments

@vha14
Copy link

vha14 commented Mar 8, 2021

This repo is really fantastic - thank you @ofhouse for your work!

I'm trying to understand the "small" picture - how things work under the hood - with the goal of implementing a version of this in Pulumi. This has been rather challenging due to my lack of familiarity with the Vercel stack and how it's used in this library. Vercel/Next.js documentations don't cover the internals well either - they are meant to be consumed by the users, not (new) developers. It would help me tremendously if there's some description of how this library works by integrating with the Vercel tools. Thanks!

@ofhouse
Copy link
Member

ofhouse commented Mar 8, 2021

Hi, thanks for your kind words, appreciate it 👍

I do not have that much time to explain it in detail now, but I published some insights in this article: Why we self-host our serverless Next.js site on AWS with Terraform.

@ofhouse ofhouse added the question Question about usage of the library label Mar 13, 2021
@vha14
Copy link
Author

vha14 commented Mar 27, 2021

The blog post you shared is really fantastic - thanks again @ofhouse !!

In other conversations I gathered that Vercel now moved their build pipeline to closed source (I understand given their venture-funded commitments.). In response, both you and blitz.js have forked the current pipeline.

Do you anticipate big challenges in maintaining these forks while aiming for feature parity with Vercel?

@ofhouse
Copy link
Member

ofhouse commented Mar 27, 2021

Hard to say, my prediction is that it will become a little easier to maintain Next.js on AWS Lambda since Vercel decided to drop the build target completely.
That means a custom server and a serverless environment on Vercel both using the same build output (.next/server) from now on (#86).
However a preparation step is still needed to make it runnable on AWS Lambda.

In other conversations I gathered that Vercel now moved their build pipeline to closed source (I understand given their venture-funded commitments.). In response, both you and blitz.js have forked the current pipeline.

Some correction here, Blitz.js has forked the Next.js project (blitz-js/blitz#1990) itself, not the pipeline.
We forked the pipeline (#36) that Vercel was / is using to customize the build output from .next/server to make it runnable inside AWS Lambda.

In general I think the task of keeping feature parity with Vercel will become more difficult since Vercel can always introduce changes to Next.js codebase that break something of our build pipeline (For example: milliHQ/terraform-aws-next-js-image-optimization#19).
This is the downside of the concept. Vercel publishes much of their software as open source, but the development and roadmap stays mostly private.
On the other side they always have to release new features that are exclusive to Vercel to stay relevant, since Netlify also works on a serverless implementation and AWS Amplify also works on serverless support for Next.js behind the scenes.

Vercel also has the advantage that they have full control over the CDN / Router, since they are operating their own network (think they were using CloudFlare before for this task), while we are currently bound to CloudFront. It can handle most of it with the help Lambda@Edge too but is lacking a lot of features compared to their CDN, since AWS has only recently begun to dedicate more resources to CloudFront development.

What makes it so difficult is that Vercel cannot support this kind of projects because they would kill their own business model if they would do this. Competition in this field is currently really hard and everyone could recently see that AWS is eating up a lot of space in the SAAS economy (MongoDB, elasticsearch).
Currently they give Serverless Framework a hard time with Amplify & CDK and I guess they will not stop there.

@vha14
Copy link
Author

vha14 commented Mar 27, 2021

This is very helpful, thanks for taking the time to explain.

@tlinhart
Copy link

@vha14 I'm also interested in getting this to work with Pulumi as that's what we are using for the rest of infrastructure. Have you been successful with that?

@vha14
Copy link
Author

vha14 commented Apr 17, 2021 via email

@ofhouse
Copy link
Member

ofhouse commented May 22, 2021

I'm going to close this issue because it has been inactive for 30 days ⏳. This helps to find and focus on the active issues.

@ofhouse ofhouse closed this as completed May 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Question about usage of the library
Projects
None yet
Development

No branches or pull requests

3 participants