Skip to main content

Deploying to Now

ZEIT Now is a cloud platform for serverless deployment that you can use to deploy your Gatsby projects and alias them to your personal domain or a free .now.sh suffixed URL.

This guide will show you how to get started in a few quick steps:

Step 1: Getting Now

You can use Now by installing Now Desktop, which also installs Now CLI and keeps it up-to-date automatically.

To install Now CLI quickly with npm, use the following:

npm install -g now

Step 2: Preparing to Deploy

With Now CLI installed, we can go on to deploy our previously setup Gatsby project by first creating a now.json file with the following contents:

now.json
{
  "version": 2,
  "name": "my-gatsby-project",
  "builds": [
    {
      "src": "package.json",
      "use": "@now/static-build",
      "config": { "distDir": "public" }
    }
  ]
}

This now.json file will allow us to do several things, specifically:

The final step is to add a script to the package.json which will build our application:

package.json
{
  "scripts": {
    ...
    "now-build": "npm run build"
  }
}

Step 3: Deploying

You can deploy your application by running the following in the root of the project directory, where the now.json is:

now

That’s all! Your application will now deploy, and you will receive a link similar to the following: https://my-gatsby-project-fhcc9hnqc.now.sh/

References:


Edit this page on GitHub
Docs
Tutorials
Plugins
Blog
Showcase