title: Separating package.json for frontend and backend with shared code
body: <p>I have a project that has a separate frontend(webpack) and backend(express/mongodb) which I <strong>would like to separate</strong> the <code>package.json</code> while being about to share some logic/utility code between them. How can I organize my file structure such that I could separate their dependencies appropriately.</p>
  
  <p>Right now this is my file structure which both the frontend and backend share the same <code>node_modules</code></p>
  
  <pre><code>app
  |
  | - frontend
  |    | - index.js
  |    | - src
  |
  | - backend
  |    | - index.js
  |    | - models
  |    | - api
  |    | - statics (webpack builds into here)
  |
  | - lib
  |    | - logic here (may require npm dependency)
  | 
  |- package.json
  |- webpack.config.js
  </code></pre>
  
  <p>I could easily separate them into 2 npm projects if they did not both require the lib directory, but that would essentially mean I have to copy the code to both folders. Is there a better way to achieve this?</p>