Answer the question
In order to leave comments, you need to log in
How to organize the file structure of a project with a MERN stack?
I have a backend based on express + mongoose. Its approximate structure is:
- /models
-- item.js
- /node.modules
-- ...
- server.js
- package-lock.json
- package.json
- /src
-- /assets
--- index.css
-- /components
--- Somecomponent.js
-- /containers
--- App.js
-- /reducers
--- somereducers.js
- /node.modules
-- ...
-- index.js
-- registerServiceWorker.js
- .gitignore
- package-lock.json
- package.json
- /client
-- /src
...
-- index.js
-- registerServiceWorker.js
- .gitignore
- package-lock.json
- package.json
- /server
- /models
-- item.js
- /node.modules
-- ...
- server.js
- package-lock.json
- package.json
Answer the question
In order to leave comments, you need to log in
Create a third package.json at the base of the project. Read more here .
Here is an example of the contents of package.json
"scripts": {
"dev": "concurrently \"cd server && npm start\" \"cd client && npm start \"",
"build": "cd client && npm run build",
"install": "(cd server && npm install) && (cd client && npm install)",
"start:prod": "cd server && npm run start:prod",
"heroku-postbuild": "npm run build"
},
"dependencies": {
"concurrently": "^3.5.1"
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question