-
ProblemOur custom compiler approach has done fairly well thus far, but we are reaching its limits. Currently we compile a blitz codebase into a next.js code base (inside But honestly this is a bit hacky and introduces a whole slew of problems that we have to try and work around. For one, runtime file paths are wrong because they are inside SolutionThe goal is to remove our custom compiler and have a more native approach. NeedsWe can do a lot through babel plugins, but the following are things we need outside of babel:
ApproachesThere's essentially two approaches we can take:
I really think we should go with the fork approach. Especially because we are way more progressive than Next.js in adding new features and optimizing DX for a fullstack framework. Maintaining a fork opens up a lot of opportunities for us. Thus far I think more people are very happy with the improvements & changes we make on top of Next.js than folks who would rather we stay closer to native next.js. What are your thoughts on this? (please include in your response if you have used Blitz or not) |
Beta Was this translation helpful? Give feedback.
Replies: 15 comments 32 replies
-
A fork makes sense to me. But maybe instead of forking with the intention of adding Blitz-specific functionality to Next, the fork should be done with the intention of making it pluggable enough to build Blitz as a plug-in. That could lead to the fork getting merged into Next and no longer needing to maintain it down the road. |
Beta Was this translation helpful? Give feedback.
-
My gut says stick with approach #1 and as @stevenpetryk suggests build Blitz as a plug-in (the next team is working on a plugin system). One of the things that draws me to blitz is that it's built directly on top of Next.js and shares the same API surface. |
Beta Was this translation helpful? Give feedback.
-
I think the question here is about the goal of Blitz. Which approach will help Blitz achieve its goals according to the set-out philosophy? For instance, let's look at: "[Blitz] Includes everything from the database to your frontend all inside a single app. Only one thing to develop. Only one thing to deploy." and also "The out-of-the-box experience guides you on a path perfect for most applications. But when you need to go off the beaten path, you are totally free to do so." Does making Blitz a Next.js plugin move it closer to those goals, or further away? What about in a year's time when Next.js becomes even more opinionated or changes direction? I feel that if the goal of Blitz long term is to be the full-stack convention-over-configuration monolithic framework for the JS community (in the spirit of Ruby on Rails and Laravel), then it makes sense to fork Next, and in the far future, potentially no longer depend on it directly at all. To create a truly amazing dev experience might require making quite significant modifications to how Next works, meaning that depending on Next would probably end up limiting Blitz not only today but in the future, as Blitz gets more adoption and can be more ambitious with its feature set. True innovation and "generational leap-frogging" improvements require the freedom to move quickly, without unnecessary constraints. Depending on Next (which would be the case if Blitz was a plugin) is the quickest way to get rid of that freedom and add quite a high level of constraints from a project with a potentially different philosophy and long-term goals. Hence I think that a fork of Next is a better choice, and I would go further and say that in my opinion maintaining compatibility with Next will become less and less relevant as Blitz develops its own ecosystem. |
Beta Was this translation helpful? Give feedback.
-
Any resources on how we would minimize merge conflicts as a fork? I'm worried this is downplaying the amount of effort involved. Since we'd be accessing internals, every next.js commit could be a breaking change, no? |
Beta Was this translation helpful? Give feedback.
-
Without knowing much about the internals of Blitz, I'd be in favour of sticking as closely to Next as possible. It is battle tested and has a company backing it and paying to develop it. Blitz feels less like a risk because of its ties to Next. I feel like moving away from Next would massively increase the work you and other maintainers would need to do to keep feature parity with Next. The fact the Blitz is a layer on top of Next is the reason I picked it over Redwood etc. |
Beta Was this translation helpful? Give feedback.
-
(1) limits the scope of the project, but (2) is... ambitious, even brave. (I have used Blitz.) |
Beta Was this translation helpful? Give feedback.
-
I'm just going to say option 2 at this point. A lot of other answers from the other comments, reflect what I want to say. 😃 |
Beta Was this translation helpful? Give feedback.
-
Blitz isn't just a codebase, it's also a community. Hard to imagine that community continuing to exist after approach # 1. I imagine it would get absorbed into the next.js community. |
Beta Was this translation helpful? Give feedback.
-
The idea of Blitz as an Add-On to Next.js seems to have been around for quite a while now. I remember Tim Neutkens mentioning it to me as early as May of last year, when Blitz was merely Next + RPC layer. Apart from the RPC Layer, most of the other things that Blitz currently does could easily be added to Next.js: Recipes, Auth (see next-auth), Code Generation (see Yeoman). Once we think about future Blitz features, Next.js starts looking old: Websockets, React Native support, ... Before deciding to fork Next.js, we need to lay out the following things:
We should be very careful with this decision, to not end as in https://xkcd.com/927/. |
Beta Was this translation helpful? Give feedback.
-
I see Next.js as a quite good frontend framework; it works perfectly for making fast websites with React and even a bit more (with getStaticProps, API routes, etc.). If you try to to more (like a dashboard with multiple models or a complex systems), you'll be a long time developing it. Then, there is Blitz.js, a incredible Full Stack framework. It's designed to quickly make a scalable app. It's overkill for a simple website, but perfect for a monolith with lots of calls to a db. I think Blitz.js should stop being "a framework based on Next.js" and be "a fullstack framework (with Next.js to handle the frontend)". Next.js would be a tool instead of the foundation of Blitz (yet a very important tool) |
Beta Was this translation helpful? Give feedback.
-
Interesting discussion! Forking next will inevitably mean that we'll probably diverge too much at some point. On the other hand we are only adding hacks to make things work around next which could eventually become a roadblock. I agree with @Skn0tt that we don't have to fix a problem we don't yet have so perhaps we can try to figure out what we really need to address and see how much of a footprint those changes might make on the short run. Perhaps little clever changes can boost blitz a lot and that doesn't mean having to solve conflicts with the upstream every day. I guess that we all agree that going wild on the fork is just a death sentence because nobody will be able to keep up with their changes. For the forseable future they'll probably focus on frontend DX but vercel is not stupid, they want the whole stack... So they'll eventually pick a winner from all the full stack framework out there or make their own thing. Im pro forking next but being clever with the changes made to it. |
Beta Was this translation helpful? Give feedback.
-
A key point that's being brought to light here is that there's a fundamental tension between Next.js and Blitz. Next.js priorities (best I can tell from the outside):
Blitz priorities:
So the challenge for us is how to navigate this? We can stick very close to next.js and sacrifice blitz priorities. Or we can fully embrace what Blitz wants which leads to some divergence from next. This is a spectrum that we can navigate back and forth in over time. But I feel that over the long term, Blitz is going to want to diverge from next at least a certain amount. |
Beta Was this translation helpful? Give feedback.
-
Would it be worthwhile to take a step back and look at this from a roadmap/api perspective? Meaning, where does Blitz want to be at 1.0 and 2.0. What are the obstacles and motivating drivers that help us choose between options 1 and 2? |
Beta Was this translation helpful? Give feedback.
-
I already asked how to migrate next -> blitz. And actually I would really like just to use the non-api approach in a next app. What if I really like the idea of blitz, but I am unsure, if the community needs a whole new framework, as there are so many next apps out there which could benefit from the non-api technology on top of existing next.js apps. For example it would be really cool, if we could just have a directory structure like:
And compiling to:
So, IMHO, I think that using blitz as an extension of next would make blitz smaller, but also easier to maintain and easier to adopt. |
Beta Was this translation helpful? Give feedback.
-
UpdateI've officially forked next.js to https://github.com/blitz-js/next.js. And it's initial integration into our monorepo is happening in #2079 I had followed up with Guillermo. He said they are looking into possibility of adding But realistically, I think we'll have a fork forever. But we'll definitely try to merge features upstream if they want them. And I'll reiterate that we absolutely plan to maintain nextjs feature parity and deployment compatibility. |
Beta Was this translation helpful? Give feedback.
Update
I've officially forked next.js to https://github.com/blitz-js/next.js. And it's initial integration into our monorepo is happening in #2079
I had followed up with Guillermo. He said they are looking into possibility of adding
import('queries/**')
which we might could use for api route generation (but it's unclear if that would actually happen or when). So I told him we're moving forward with a fork for the sake of progress with an eye to remove the fork at some point.But realistically, I think we'll have a fork forever. But we'll definitely try to merge features upstream if they want them.
And I'll reiterate that we absolutely plan to maintain nextjs feature parity and deployment …