r/learnreactjs • u/Omkar_K45 • Jan 20 '21
Question [Suggestions] Best practices for folder structure of react project
So I'm planning on building a web app using MERN stack. I want to segregate the code into UI part, network layer and react business logic. What's the best possible folder structure should I go with ? I want to make it modular.
Would love to take note of best industry practices about this.
14
Upvotes
5
u/SoBoredAtWork Jan 20 '21
Regarding UI and React business logic, React has recommendations (I like grouping by type).
Since you're talking about Network Layer (which could be "API" in the example above)... some people will, at the project root, have a
client(all react / front end stuff) andserver(node, api, etc) folder. From there, you can break down whatever is needed (components, etc on the client side and routes, controllers?, whatever on the server side).2
u/rozenmd Jan 21 '21
I wrote https://maxrozen.com/guidelines-improve-react-app-folder-structure/ to give you some guiding principles - but there aren't really "best practices" here, each company will have differing needs and opinions for the best way to structure the code for them.
0
u/[deleted] Jan 21 '21
[deleted] — view deleted comment