To precurse this question I'll mention that this is my first question on Stackoverflow so I'm sorry if I miss out on common practices or miss something else that makes this easier to answer.
My question refers to the way that others structure their full-stack applications. In my case, I'm making a PERN (PostgreSQL, Express, React, Node) Stack application. I've looked around and seen some tutorials that suggest that there should be a separation of concerns for front-end and back-end meaning that there should be a root/
directory that contains a /client/
and /server/
directory with their own package.json
, node-module
, etc. I'm assuming that the README.md
, .gitignore
, and other common files are still in the root. Overall, I would like to know what directory structures are common to use and if my presumption on the information given is correct.
Example:
├─ client/ │ ├─ node-modules/ │ ├─ public/ │ ├─ src/ │ ├─ package.json │ ├─ package-lock.json │ └─ ... ├─ server/ │ ├─ node-modules/ │ ├─ index.js │ ├─ package.json │ ├─ package-lock.json │ └─ ... ├─ README.md ├─ .gitignore └─ ...
Also, I'm curious about the name dedicated to the Javascript that runs the server. I've seen index.js
and server.js