How would you set up CI/CD for a Node app?

Node.js testing, performance and deployment · Experienced

Model answer

On each push run install with npm ci, lint, tests and the build. On merge to the main branch, deploy automatically: build an artifact or image, copy it to the server, run migrations or seed scripts if any, restart pm2 or the container, and run a health check with rollback on failure. Keep secrets in the CI secret store.

Learn this topic

Deploy a MERN App to a VPS with pm2, nginx and HTTPS (Let's Encrypt) in the course MERN Stack Full Course: MongoDB, Express, React and Node.js.

Sign in to add your own answer.

More questions