DEV Community

Cover image for Automatically Deploying Nuxt.js + Express app on Now
Maksim Surguy
Maksim Surguy

Posted on • Updated on

Automatically Deploying Nuxt.js + Express app on Now

I published a demo project that can help you understand deployment environments on Now.sh and how to automatically push to those environments using Github Actions.

Here's the link to the project: https://github.com/msurguy/nuxt-express-now

More about the repository:

The project has minimal structure to it, but it achieves the goals of demonstrating automatic deployments. It:

  • Uses latest stable version of Nuxt and Express (currently Nuxt 2.9.2)
  • Uses API endpoint from the ENV file (or from Now.json files)
  • Uses Github actions to deploy when a tag with a specific pattern is pushed
  • Uses ES6 in Node server code
  • Uses basic auth that is conditionally enabled / disabled via env variable
  • Automatically trims old deployments (that are not aliased) once a week

Assumptions

  • The default branch is staging. All PRs in the project are made against that branch
  • When testing is done on staging and approved, PR is opened against master
  • When this project is automatically deployed via Now + Github integration (not through Github Action), it uses now.json as the config.

Here's the diagram of what's happening when you push certain tags to the Github repository:

Now and Nuxt and Express development

Hope you enjoy and share this project!

Top comments (0)