Replies: 15 comments 29 replies
-
I'll start! :D Personally, I think that Blitz should not be too opinionated about this. Any kind of architecture should be possible. However, this doesn't forbid Blitz from recommending something! Especially when projects become bigger, architectural patterns gain importance. (Personally, I really like the idea of the Onion architecture - although I've never built a product with it, so this is to be taken with a grain of salt.) |
Beta Was this translation helpful? Give feedback.
-
I would prefer opinionated + being able to choose your own, like Prisma. NextJS is already un-opinionated. A framework that has initial answer on "how-to-do-this-or-that", like Rails or Laravel, would be great. Forget about how, and work only on the product. |
Beta Was this translation helpful? Give feedback.
-
I'm especially curious to hear from folks who are using Nest about what you would like to see in Blitz and ideas for how it could be implemented/integrated. |
Beta Was this translation helpful? Give feedback.
-
Considering we're already using an opinionated framework (especially with regards to routing) on the front-end with Next, I'm sure having a preferred structure on the back-end, while not necessarily enforcing it exclusively, could really be beneficial for newcomers. This could help front-end focused developers ease into the server side of things with a little guidance. Maybe this could be achieved via templates instead? That way there's still options but the Blitz core is not tied to anything specific. |
Beta Was this translation helpful? Give feedback.
-
node backend is not as popular as php-laravel, ruby-on-rails.
|
Beta Was this translation helpful? Give feedback.
-
One of the benefits of using Next.js as a base is the ability to maintain a serverless architecture. That way it's cake to throw your Blitz app onto a platform like Vercel. When you add a custom server, using something like Express or Koa, you'll lose some of the nice static optimization features Next provides. To be clear, doesn't the idea of using a framework like Nest.js imply a custom server? |
Beta Was this translation helpful? Give feedback.
-
👋 I'm just starting to test out Blitz, so take my opinion with the appropriate grain of salt. There is a reason for the "Great -end Divide". The data layer (backend 🙉) is where projects diverge. You will want a very different backend for e-commerce vs. blog vs. todo vs. ... The other option is to go so generic that it is not useful. Express can do anything, but that doesn't get you a headstart on anything. I'd suggest a more modular route allowing choice. Extend Blitz's recipes to include backend choice. This might require setting up the project as a yarn monorepo to allow for independent deploy process for client(s) and server(s). |
Beta Was this translation helpful? Give feedback.
-
Opinionated is good Everthing in their box is a great idea. For the experienced one, changing structure is easy, but not the other way around. A newbie can make a mess real quick, or over-engineer because some opinions from stackoverflow / quora. |
Beta Was this translation helpful? Give feedback.
-
I'm working with nestjs. So far I've added
I've probably covered most of it. 😸 Problem is. I'm getting to the point where I'm getting an itch to scratch. As a side point, the next docs aren't great. Compared to Laravel and Vue, they aren't noob friendly and don't explain concepts well enough. I've had to cobble this up by googling articles, looking at github repos and even at package repos. Not to mention some of the deviations didn't work for me (such as JWT). A further side point. Not sure about the community. 🤨 I've seen a couple of arguments between mods and users over semantics and when I had an issue with JWT. I came across one user who was adamant that because I wasn't using it for passport, I was the one with the problem. Although the nest devs derived jwt from jsonwebtoken. To resolve the issue, I had to use the original package. Anyway, that wasn't why you called... 😀 What I don't like the most is that I'm duplicating work. Mainly with
Having 1 source of truth, for such a large project as mine would be supremely helpful. But more than that, I have 3 codebases (BlitzJS, NestJS, Golang) I'm having to maintain. I'd like to get that down to 2. I was thinking. At a high level. Could we have something like this? Pages: sets up routes like it does now. This way, we have a pseudo MVC when doing something like:
The controller would just be pointing to a service, which in turn would use prisma to grab the data and return it. Sure in this case it's a simple query. But nest allows for much more complex scenarios than blitz currently does. So the question is. Is there a way of forking nest, so that something like /hoangvvo/next-connect could be realised and have more endpoints for the application. Additionally, have these same endpoints available by the application only. Anyway. I just thought I'd share my thoughts as an opening salvo. I'm getting to a point with my project where I may be able to divert time getting into the guts of Blitz and then Nest and for my own purposes trying something out. Like I say, I have a bit of an itch. Usually when I can't no longer ignore them, I start to fork the framework that I'm working on. I did this for codeigniter, laravel and countless js/php packages 🤣. If anyone has any ideas on what I should be looking at first to prepare. I'll be all ears. Thanks 👍 |
Beta Was this translation helpful? Give feedback.
-
I would like to ask for clarification about this topic, is it about:
Or it's about all of it? In my opinion, replacing parts of BlitzJS abstraction with NestJS will be beneficial for several reasons:
Also, NestJS offers a range of abstraction useful for integrating stack with external parts (or other applications) in various ways:
Talking about that, even if you are not considering switching to NestJS based abstraction, it would be great to offer some integration concepts for people using BlitzJS as this is IMHO important area - it's easy to start working with BlitzJS but it might be hard for folks to integrate BlitzJS into existing solutions or extend BlitzJS functionality with some custom functionality. It might not relate to NestJS but I am referring to it because it's the only framework I consider enterprise-grade. |
Beta Was this translation helpful? Give feedback.
-
I have also worked with Nestjs and find the structure very clear and simple. All features are individual modules such as auth, tasks etc.. My structure are quite similar in Blitz. For the individual features of my app, I have created several folders: auth, users etc.. After a few weeks of development, I realize that this organization is not perfect yet. I have everything sorted by features, but it's hard for me to see which functions are for the backend and which are for the client. I have some helper functions that are for backend and client and then I have functions that are only for backend and only for client. I would like to see some improvement at this point. Personally it would help me if we had a backend and a client main folder. So we could better differentiate which code is for the backend and which code is for the client. @flybayer But isn't such a structure already possible now? |
Beta Was this translation helpful? Give feedback.
-
I've been following Blitz.js for a while but I haven't used it yet, so take my opinions with a bag of salt, but I've been writing backends in node.js/typescript for a while, imo, Blitz is currently close to a barebones MVC project, JSX pages are the view layer, the ORM models are the Model layer, what's missing is the Controller. Since I haven't used it myself I can't tell for sure, but I imagine having every route be its own file to grow tiresome at some point, especially for simple CRUD operations (speaking of which, is there a reason why queries and mutations are split? i skimmed the docs but i didn't see a point on why, my only guess is that they're setup as GET and POST routes). What I have in mind is somewhat simple, you export a class extending a base controller type, you define your API methods there, with the same way queries mutations work right now, resolver.pipe can be turned into a decorator and have it work like it did before. Example: export default class ProjectsController extends Controller {
@Mutation()
@resolver.pipe(
resolver.authorize()
resolver.zod(projectSchema)
)
async addProject(input) {
// etc etc
}
@Query()
@resolver.pipe(
resolver.authorize()
)
async viewProject() {
// etc etc
}
} and then you'd fetch an instance using useController(ControllerClass) This approach is basically just grouping together the scattered queries and mutations into one class. this approach would benefit from the .server.js suggestion earlier for user made backend code, e.g (splitting your business logic out of the controller and ORM layer) Pros:
Cons:
This wouldn't give Blitz a full blown backend solution, but I think it includes the least learning overhead to blitz.js users, compared to integrating with Nest.js, while at the same time offering enough to build more elaborate backend structures. As for the cons, you'd face the same either way if we took the Nest.js route, and ORMs technically already introduced OOP into the project. |
Beta Was this translation helpful? Give feedback.
-
add nodejs or django |
Beta Was this translation helpful? Give feedback.
-
If I follow the CCD development model, such as using Storybook, I don't know if it will work. For me, I can use Node-based development frameworks such as Hapi, koa, and Fastify to do almost the same thing, and it has better scalability. I think that if Blitz wants to be more impressive, it needs to produce the necessities and even semi-finished products needed for the project more quickly. For now, frameworks like Blitz did not touch my heart in the first place. Our sense of direction does not seem to be very clear.I think the cross-generation product is definitely not looking vague, it should give people a strong sense of direction.Know where we are and in which direction we should go. |
Beta Was this translation helpful? Give feedback.
-
In our community Discord, @flybayer asked the following:
I personally like Nest a lot (used it in EntE), and I wrote a (surprisingly popular) article on integrating it with Next.js (which is surprisingly easy).
And while Nest is great, there's a million other ways to structure your backend.
Some people really, really, really like the onion architecture; others would advocate for a plain-old MVC; and there's so many more people with other opinions.
In this discussion, I'd like to gather opinions and ideas around the following questions:
Looking forward to hear your thoughts! Make sure to add upvotes/reactions to ideas and thoughts you like 👍
Beta Was this translation helpful? Give feedback.
All reactions