How to structure react / node / redux project


(Lasha Lezhava) #1

Hello!

I am planning to learn full stack web development, the knowledge of how to structure projects is very important. It is not a big deal in the beginning, but as the project grows, without correct structure the management will be very hard.

I have made a small video streamer project: https://github.com/AngryL/VideoStreamer. And even if it is tiny, I saw, that I don’t want to reinvent the will and see how such projects should be designed.

I want to start another (bigger) project with react / node and would like to know some theory before starting.

I have read some articles about this topic, but would like to get answers from people, why had real challenges in their projects and solved real problems.

So I will appreciate any literature which covers this topic.

It will be very helpful if you link here good react/node/redux project at GitHub, which is built according to best practices of those technologies and have a good structure.


(Zackery Griesinger) #2

Hi Lasha,

I have worked over a year on multiple React apps. Some large, and some small. Some using Node.js and some having no backend at all. That being said, your question is a hard one to answer, as no project is similar and many times the structure of the project depends not on what frameworks are being used but how they are being used. Ultimately this question is kind of something you have to answer for yourself.

I have found myself many times, thinking “Wow, I really wish this particular project was structured like X or how I really like how project Y structured itself.” Once you experience these things you can build a set of preferences for yourself and how you like to structure not only React/Node projects but software projects in general.

I would like to point you to this tweet from Dan Abramov, on the React team here. There are a lot of people with a lot of opinions on file structure and there’s no real way to say whether certain things are good or bad, as it can come down to developer preference.

That being said, I do have one piece of advice:

Keep it consistent

The largest struggle I’ve had to face is an inconsistent structure, in my experience very rarely will project structure cause code to become hard to maintain. It’s almost always the case of inconsistent architecture causing the project to become hard to pick up for new developers and cause great headache for maintainers. Developers are very quick to jump to, “Hey! This file structure will solve all of our problems, we should use this!” as a silver bullet. If you have a clearly defined set of rules for project structure and you adhere to those rules, you likely will avoid problems. And if you do, take the time to fix it, and add your error to your list of file structure preferences.

TL;DR: It doesn’t matter, start hacking, find out what you like and don’t like, but most importantly, whatever you decide, keep it consistent. :grinning: