Justin

Justin

09 Nov 2020ยท2 min read

Netlify CMS & Next.js Series - Local Deploy

#netlify #nextjs #headless-cms #react

Making changes and waiting for the app to deploy and build on Netlify can slow down your development flow so let speed that up with local deploys.

NOTE: Local deploy is a Beta feature of Netlify CMS so use at your own risk!

First add the local_backend property to our config file and set it to true:

filename: public/config.yml

backend:
  name: git-gateway
  branch: master
local_backend: true
media_folder: public/images

Then run a local Netlify CMS server using the command in the root of the project:

npx netlify-cms-proxy-server

This will start up a local CMS server on port 8081:

info: Netlify CMS Proxy Server listening on port 8081

Now if your go to your local admin url the content will be served up from this server:

[http://localhost:3000/admin](http://localhost:3000/admin)

Much quicker, now we only need to deploy when our features are ready ๐Ÿ™‚

Bonus

To save you having to remember the Netlify CMS server command add a script to your package.json:

filename: package.json

"scripts": {
        ...
    "local-server": "npx netlify-cms-proxy-server"
  },

You can now run the server using the command:

yarn local-server