title: Can the frontend and backend share the same package.json?
body: <p>I have a small personal project which I'm developing in one single repo.</p>
  <p>The backend is a Node.js server and the front is a Vue.js application.</p>
  <p>I want both of them to share the same package.json</p>
  <p>The only reason I want to do that is because I want to use the <code>&quot;scripts: {}&quot;</code> of that one common package.json to execute commands that refer to either backend or frontend modules.</p>
  <p>Is this possible ?</p>
  <p>Would this structure make sense and work:</p>
  <pre><code>- my-project
    - front
      - {Vue.js files &amp; folders}
    - back
      - {files &amp; folders for my server}
    - package.json (containining dependencies and yarn scripts for both front and back)
  </code></pre>
  <p>But does that also mean that when e.g. Vite/Vue compiles the .js files for production it will also &quot;accidentally&quot; include irrelevant node_modules that were actually there only for the backend to use?</p>
  <p><strong>UPDATE:</strong>
  I tried it and it's pretty clean and straightforward and works fine.
  I'm posting this here in case anyone is interested:</p>
  <pre><code>- /root
    - /back (contains server files &amp; folders)
    - /front (contains Vue.js files &amp; folders)
    - package.json
    - .eslintrc.cjs
    - .gitignore
    - vite.config.js
    - yarn.lock
  
  // contents of package.json
  {
    ......,
    ...,
    &quot;type&quot;: &quot;module&quot;,
    &quot;scripts&quot;: {
      &quot;back:start&quot;: &quot;nodemon --experimental-modules --es-module-specifier-resolution=node ./back/server.js&quot;,
      &quot;front:start&quot;: &quot;vite&quot;,
      &quot;front:build&quot;: &quot;vite build&quot;,
      &quot;lint&quot;: &quot;eslint . --ext .vue,.js,.jsx,.cjs,.mjs --fix --ignore-path .gitignore&quot;,
      &quot;start&quot;: &quot;yarn front:build &amp;&amp; yarn back:start&quot;
    },
    &quot;dependencies&quot;: {
      .....,
      ...
    },
    &quot;nodemonConfig&quot;: {
      &quot;ignore&quot;: [...]
    },
    &quot;engines&quot;: {
      &quot;node&quot;: &quot;^16.14.0&quot;
    }
  }
  </code></pre>
  <p>I'm deploying the above on Heroku as is and Heroku simply calls <code>yarn start</code> and the app is built and deployed. (You'll notice I have no &quot;devDependencies&quot; and that's because Heroku ignores everything under &quot;devDependencies&quot;, including vite)</p>