Self-hosting n8n — the Free Zapier Alternative

Robin Granqvist
4 min readMay 11, 2024

--

Have you heard of Zapier? Of course you have. At least if you’re into no-code/low-code web development.

Now, have you heard of n8n? Probably not. It’s a production ready Zapier alternative that lets you create powerful workflow automations between other applications.

The n8n interface
The n8n interface

And the best part? It’s free. Almost at least.

This guide will hopefully help you get setup with self-hosting n8n on the cheapest DigitalOcean droplet available. It will run on a sub-domain under your own domain, which I think is super cool.

According to my (limited) research, $7/month should be able to handle multiple workflows running in parallel without problem at all times of the day. Isn’t that crazy?

It could potentially save you hundreds of dollars a month, depending on how much you like automating things. Zapier is getting expensive.

A couple notes:

  • I’m not an expert on n8n. I don’t know how it compares to Zapier in terms of available applications, stability & other features. It seems to be running really well with the things I’ve tried so far though.
  • This is not a sponsored post, even if it may sound like one. I just really like open source / free alternatives to otherwise super-expensive software.
  • The setup may look intimidating, but remember; it only has to be done once. When you’re done you’re fully set to start automating.

Let’s go

Let’s go through the setup step by step. You can also check out my video I just published on YouTube, it might help you out.

1 — Sign up to DigitalOcean

The first thing to do is to sign up to DigitalOcean and connect a payment method. The onboarding is great, no worries.

2—Create a new DigitalOcean project

I just named mine “n8n” or something similar. This doesn’t matter.

3—Create a droplet

A Droplet is basically a virtual machine. It runs in the cloud somewhere and lets you install software that can run 24/7 forever.

You should choose the following settings:

  • A location close to you.
  • The Docker image that can be found through the DigitalOcean Marketplace.
  • The cheapest virtual machine harware works fine for most usecases.
  • Password authentication (if you want to make it easy for you) with a complicated root-password.
  • A simple & sweet Droplet name.
DigitalOcean Droplet
DigitalOcean Droplet

4 — DNS

As mentioned, n8n will run on a subdomain on our own domain. This is done by creating a single A record on your domain registrar.

The host should be whatever subdomain you want to use (in my case simply n8n) and it should be pointed to the IP-adress of your Droplet. You’ll find your IP in your Droplet settings.

5— Open the Droplet console

The console might seem intimidating, but it’s really just copy-and-pasting commands from here on out.

The console can be opened by going into the Droplet settings.

The Droplet Console
The Droplet Console

6— Commands

Let’s just follow the official docs for deploying n8n on a DigitalOcean Droplet. Each command can be pasted in the console and is ran by simply hitting enter on your keyboard.

The first command is cloning the Github repository to our Droplet.

git clone https://github.com/n8n-io/n8n-docker-caddy.git

Then we’re moving ourselves into the newly created folder.

cd n8n-docker-caddy

Now we need to create a couple Docker volumes for its cache.

sudo docker volume create caddy_data && sudo docker volume create n8n_data

Then we need to open a couple ports in our Droplet’s firewall

sudo ufw allow 80
sudo ufw allow 443

7— Configure files

There’s two files we need to configure in our cloned files — the .env file & the Caddyfile. Each file is opened in the console using the “nano” command, saved by pressing CTRL + S and exited out of by pressing CTRL + X.

Let’s start with our .env file. This file can be edited with the following command:

nano .env

The following edits should be done in the .env file:

  • The directory_path in the DATA_FOLDER variable should be set to “root”
  • The DOMAIN_NAME variable should be set to your personal domain name
  • The SUBDOMAIN variable should be set to whatever you named your subdomain (in my case n8n)
  • The SSL_EMAIL should be set to your personal email

That’s it. Now let’s edit our Caddyfile:

nano caddy_config/Caddyfile
  • The domain on the first line of the file (<domain>.<suffix>) should be set to your full subdomain, in my case n8n.shapedbyrobin.com

That’s all.

8 — Spin up Docker

Let’s start Docker with the following command in the console:

sudo docker compose up -d

Now, if the DNS propagation is complete (may take a few hours), you should be able to access n8n on your subdomain. Here you’ll be able to create your own admin account and start automating.

How it might look when Docker spun up successfully

9— We’re done

Now you should have an instance of n8n running on your personal subdomain. Isn’t that cool? Yes it is.

If you have any questions, feel free to leave them in the comments below or contact me.

--

--

Robin Granqvist
Robin Granqvist

Written by Robin Granqvist

design // web development // music production // minimalism

No responses yet