Introduction
In the fast-paced world of frontend development, staying ahead of the curve is essential for building successful enterprise...
Some comments have been hidden by the post's author - find out more
For further actions, you may consider blocking this person and/or reporting abuse
types
is a terrible folder to have. Your folder structure should reflect your features, not the technologies they use. I wrote an article about this dev.to/mfp22/why-your-folder-struc...This comment stood out to me because I created a types folder despite hating it only to politely act on code review comments of someone out of office. Because of a policy to resolve every code review comment.
But absolutely yes to the idea of grouping by feature first.
Thanks for the feedback Mike, I agree folders should reflect features but I think it makes sense to put some global types in folders like
types
. If you have a type likeUser
that is used accross the entire app it might make sense to put it here but other types likeProduct
for example can stay in their respective modules/features. What do you think?User
should be in a folder calleduser
. Who says you can't import features into other features? We do that all the time.I have never seen an example of a type that belonged in a global types folder. I actually think of types as the foundation for the folder structure, since they are the foundation of each feature.
Great article otherwise
Why put Next.js in title and promise to tell us about structuring, but not saying a word about the Next's app directory? App directory makes a big difference.
Yes but a lot of NextJS projects are still on v12. For the app directory I recommend looking for somethings that says Next 13.
This is basically a good example of your own expectation kills you.
Just an example of a misleading title. It doesn't kill you, nor makes you stronger.
It's not even close to your so-called "misleading title". You're just assuming the OP is gonna talk about the present Next.js which is the 13 version. When in fact, there's nowhere about its gonna talked about latest Next.js.
ouch
This was good and actually transfers a lot. We are Vue based but a lot of what's identified here can be applied to other projects e.g. we have an Nx monorepo, separation of projects by lib, microfrontend, UI, apps, TypeScript first, TDD, strong lining and naming conventions, document your conventions etc.
One thing I'd add to the above is a strong automated pipeline for PR's. When you have big long term projects those things save so much time.
Thanks Craig, automated pipeline for PR's is a good addition.
"If you are using CSS" what do you think is the best alternative?
Thanks Nice expalnation. Saved.
Hi Naveen, for me I use tailwindcss most of the time. I have also tried CC-in-JS solutions, they were good but i find tailwind to be much faster.
Thanks for replying
bro! wow! awesome
Thanks bro, glad you liked it.
very impressive read!
Thanks Dom
Next.js is a powerhouse, and your wisdom on frontend architecture is truly inspiring. Follow @danielgree
Thanks Daniel.
Great post!
Thanks SamucaDev
I use most of the tools here .. glad to know I been following the best practices.. this is an amazing article anyways 💡
Thanks Adams