My FeedDiscussionsHeadless CMS
New
Sign in
Log inSign up
Learn more about Hashnode Headless CMSHashnode Headless CMS
Collaborate seamlessly with Hashnode Headless CMS for Enterprise.
Upgrade ✨Learn more

Folder structure and best practices for a MERN app

Dave Rodriguez's photo
Dave Rodriguez
·Jun 13, 2020

I currently follow this pattern in my projects. I have a question regarding components and containers, and redux. Redux docs say follow the duck pattern which means to have actionTypes, actions, reducers all in a single file.

I'm also concerned about the naming practices. For example, in actions folder, should the file be named as userActions.js or just users.js. Similarly for the reducers folder. In the controller functions I have named it usersController.js, should I rename it to just users.js?

Here is my folder structure:

client
   components
         Login.js
         SignUp.js
   actions
         users.js
         index.js
         actionTypes.js
  reducers
         users.js
         index.js
App.js
index.js
store.js


models
   User.js
controllers
   usersController.js


routes
views
app.js