-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve file structure #90
Comments
I agree as there are several errors in the file structure and the import of these examples would one leave a index.js in each folder and from there export files, classes or components that are part of that folder
|
@carloscuatin I think we should have index.js in reducers folder, than each reducer have its name as the purpose, that way in index.js we can utilize good example that I really liked was @choonkending repo react-webpack-node, each reducer as the name as the reducer and added in index check it out here Also we should add actions by there name as well as in the future this repo should include another api for users so in future we could have /actions/posts.js and /actions/user.js or whatever future action js file that is needed Also this brings up questions with server side api and how we would include a new schema to our exisitng api? I know we would add a controller and model but what about applying it to our current server.js file? |
exactly what I mean @SOSANA in fact I'm already asking about certain changes to include REACT-router-redux and agree we should separate our api project and then implement nothing but a proxy so that it can be used in mern |
@carloscuatin started refactor reducer plus implementation react-router-redux, you down to update rest of redux folder as per my comment on pr #93 @prank7 @carloscuatin I will do a pr for a refactor in shared components and container to have no sub folder just js files. I will update our module pattern for files affected by new directory path. Are okay with this? plus I'll update files to remove minor errors to fix for eslint that keep showing up I can do at same time. |
@SOSANA @carloscuatin sure. We need to get rid of redux folder and it should look more like this-
I am in favour of keeping folders inside components and containers because it leaves the scope for anyone using css modules to write css files in the same folder. However, we should rename the main files inside these sub-folders to go by the name of Is it a good idea to include |
@prank7 @carloscuatin what if we used domain file structure instead of organize files by nature (action, component, container, reducer)? curious if you have this problem working on hashnode or larger projects? "Fast forward two months from now, and the components/ directory contains dozens of files, and I need to open 4 files in 4 different directories each time I touch a single feature." check out this blog
|
@prank7 the idea of implementing react-router-redux is because react-router is not well liked redux, implementing react-router-redux allow you to have full control of our application from redux |
What do you think about this suggested folder structure approach? |
Hello, everyone. Past few weeks we have been busy with the development of hashnode. In coming weeks, we are planning to actively work on mern. Regarding the file structure, what @SOSANA has shared make sense. I've added little changes to that structure. Let me know what you think.
|
@somus 1+ |
I also think, we can merge both client and shared folders. Because the client is only holding the index file. |
I've added little changes to file structure from my previous comment. Instead of pages, I made it into modules because different pages can use the same reducer. So, it doesn't make sense to put in the pages folder. Now each module folder will have a pages folder where all the related pages for that module will go.
|
I'm not sure if you merged client and shared folders yet, but for what it is worth, as a beginner having that seperation albeit small does help with understanding |
add atomic design ? |
like I said, beginner, I'm going to use it whatever the structure is and appreciate the great work you guys are doing! I see user being added, is it possible to add something around authentication passport? |
of course this is going to do with a flag of mern-cli Hashnode/mern-cli#10 👍 |
@hounded Thanks for your kind words. :) We are thinking to merge it because client folder is there to hold just the index file. In server also, we are importing the routes file for server rendering only. Rest of the server code is for handling APIs. The user is in the comment is for explanation purposes. Adding authentication to the a boilerplate project is not good, bacause different people want to use different authentication methods. We cannot settle on one. So, we planning to enable mern-cli initiate different version of mern project. One of them can be a fork with authentication. As @carloscuatin mentioned, you can read in detail about in Hashnode/mern-cli#10. @carloscuatin Atomic design can be confusing for beginners, since it introduces new terms. |
@somus cool, thank you |
@somus totally agree only this structure enrieda me a little, and I think it is better for beginners folder structure used in the same examples of redux. Not that opinions have |
Done on v2 branch(c9b74d4). |
We need to refactor the file structure of
shared
directory.The text was updated successfully, but these errors were encountered: