Strapi development vs production (start vs develop)

System Information
  • Strapi Version: 4.23.1
  • Operating System: Ubuntu
  • Database: MySQL
  • Node Version: 20


I’m new to Strapi and am trying to understand its core deployment and development principles. My goal is to run a Strapi app in both development and production modes on one code base.

Initially, I assumed that running strapi develop would provide a dynamically updated build distinct from production, achieved through strapi build && strapi start. However, it appears that the production build is not completely independent from the development build. Despite running on different ports and utilizing different databases (I’m using pm2 with ecosystem.config.js to manage the instances), both modes share the same files. This means if I introduce an error in development, it inadvertently impacts production as well - this is what I’ve observed.

Could anyone advise on the best strategy for running development and production instances on the same server? Should I place them in separate directories, or is it possible to direct development builds to one folder and production builds to another?

Any suggestions are welcome!