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

Add Next.js example #312

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Add Next.js example #312

wants to merge 1 commit into from

Conversation

maxproske
Copy link

@maxproske maxproske commented Dec 8, 2022

Next.js is one of the most popular React frameworks, and awesome-compose is a fantastic springboard, so I think this example is a great addition for people looking here to Composeize their Next.js apps.

It's also a rapidly evolving framework, with every release being their biggest release ever, and often contains breaking changes. For example, bumping the minimum version of React to v18.2. For this reason, I think it's more appropriate to link to the official Next.js + Compose example, so it can be maintained by the Next.js community and Next.js team, and enjoy more frequent updates and finetuning.

This example is a bit different, and I know submodules aren't allowed #235 (review). But I noticed some reviews in this repo can take up to a few months, so I hope you consider my reasoning and making an exception for Next.js!

Next.js and Compose is a powerful combo. Combined with Multistage builds, it can output up to 85% smaller Next.js apps! (Approximately 110 MB compared to 1 GB with create-next-app)

@maxproske
Copy link
Author

maxproske commented Dec 8, 2022

Cc @glours just in case. It would be cool to have this ready in time for this month's Community All-Hands, when I'll speak on Compose + Next.js. Cheers!

@tabuchid
Copy link

Might be worth noting that the official example isn't well agreed upon as best practice. And the next team hasn't been super responsive. vercel/next.js#16995

@maxproske
Copy link
Author

maxproske commented Dec 12, 2022

@tabuchid I'd love to know what improvements you see can be made, so I can help make them. (For example, if awesome-compose has firm stances on alpine, graceful shutdown, etc.)

As for your concerns, the VP of Developer Experience wants to continue to evolve the best practices for using Next.js with containers: vercel/next.js#16995 (comment). They also made a tutorial recommending Docker for Next.js developers: https://www.youtube.com/watch?v=Pd2tVxhFnO4. Next.js has 3 official Docker examples. Docker is recommended for self-hosting in the docs: https://nextjs.org/docs/deployment#docker-image. The Next.js team also recently added support for developing the Next.js core in Docker: vercel/next.js#43138.

@tabuchid
Copy link

@maxproske Two main issues as far as docker is concerned. And to be fair I'm not sure there are great answers to them. I just wish the next team would acknowledge them and address the community.
Both issues only apply to the production dockerfile where a build occurs.
First, if you next app needs to talk to a backend the it needs to be up and running with networking hooked up prior to building. vercel/next.js#16995 (comment)
The second is semi related. Because of how things get bundled at build time there is no good way of building once for multiple environments without resorting to building at runtime. vercel/next.js#16995 (comment)

My other next gripes are unrelated. No request logging and apm/observability integration limitations.

As I write this I'm realizing these likely shouldn't be blockers to recommending their suggested docker-compose setup. It's as good as it can be given their limitations.

@mattquest
Copy link

disappointing to see this PR left with no activity from Docker

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants