Rapid Product Development with n8n

By Jason McFeetors , Tanay Pant
    What do you get with a Packt Subscription?

  • Instant access to this title and 7,500+ eBooks & Videos
  • Constantly updated with 100+ new titles each month
  • Breadth and depth in over 1,000+ technologies
  1. Free Chapter
    Chapter 1: Introduction to No Code, n8n, and Bubble
About this book

Explore how n8n enables you to connect different systems and cloud services without having to hire specialists or develop technical skill sets across multiple tech stacks. This book will show you how n8n can reduce the time required to develop new products, helping you bring them to the market quickly compared to building a whole development team.

This official n8n guide will assist you with adopting and integrating n8n in your development workflow in the best possible manner. You'll begin by learning where n8n fits in the tech stack of your business and how it provides opportunities for reducing cost as well as increasing efficiency and revenue. Once you've identified opportunities where you can leverage n8n’s connectivity and automation functionality within your working environment, you'll progress to building an n8n-based toolset that will increase the profitability of your operations.

By the end of this product development book, you'll be able to identify real-world opportunities to generate income, improve efficiencies, and then build tools to capitalize on these opportunities.

Publication date:
February 2022
Publisher
Packt
Pages
236
ISBN
9781801817363

 

Chapter 1: Introduction to No Code, n8n, and Bubble

A movement is slowly building in the tech industry. This movement sees ordinary computer users developing digital solutions and integrations with tools that abstract away computer code complexity. These tools, collectively referred to as no code tools, empower people who, previously, would never have been able to build solutions.

By the end of this chapter, you will have an understanding of no code and why it is becoming important to businesses and technology. You will also become familiar with n8n, a no code automation tool, and Bubble, a no code development platform.

This chapter will cover the following main topics:

  • What is no code?
  • Why does no code matter?
  • An introduction to n8n
  • How do people use n8n to solve problems?
  • An introduction to Bubble
 

Technical requirements

For this chapter, you will need the following requirements:

  • A computer running a Debian-based Linux distribution such as Ubuntu or Raspberry Pi OS
  • Internet access to install n8n
 

What is no code?

Software has completely revolutionized how we work and live over the last half-century. In as little as half a century, expensive and bulky systems reserved for science and academia have evolved to become as ubiquitous as the kitchen sink, and often more affordable. We now collaborate with people on the other side of the planet as effortlessly as we talk with our neighbors over the back fence.

These systems have transformed modern society with their ability to automate complex tasks and manipulate data consistently. Instead of handwriting a letter, putting a stamp on it, and mailing it across the country to be received several days later, we compose an email. Thanks to the underlying infrastructure systems and automation that's been deployed over the last few decades, this information arrives in seconds.

But what happens when you want to do something unique or specific to your environment? What if you're going to do something niche? What do you do when there isn't an app for that?

Historically, you would learn a programming language and write a script or application to perform that task. Unfortunately, for many ordinary users, this is more than they are willing to take on. The idea of learning an entirely new language to save a few minutes each day does not feel like a favorable return on investment.

The other option is to hire a software developer to build the application. This option sounds like a logical one. But with the average annual salary of a software engineer in the United States being $110,000 (https://www.indeed.com/career/software-engineer/salaries), this may be too costly an option with little return on investment.

So, where does that leave us? Do you abandon the project, deciding that the savings are not worth the cost or the effort? Previously, that probably would have been the outcome of such a dilemma, but a third option has recently appeared on the horizon. It is at this point where no code steps into the picture.

Ordinary people use no code tools to create applications and services without learning a new programming language. They are often web-based tools that are intuitive to learn with minimal coding (if any) required. When coding is needed, the solutions are usually easily found on the product's community forums or built for a nominal fee by an entrepreneurial hobbyist.

This doesn't mean that having a coding background isn't helpful. Knowing the basic concepts surrounding computer programming such as how to write out the steps for a process from start to finish will help speed up the successes that a no coder experiences. But they are not strictly necessary.

Now that we have a better understanding of no code tools and the entire no code movement, it is essential to look at the ramifications of no code on the tech industry, business, and the average citizen. Is it something that completely changes how we, as a society, look at computers and technology in general, or is it just the latest tech fad that, in the end, will be quickly replaced with the "next big thing?"

 

Why does no code matter?

If you speak to certain developers today about no code tools, many of them will tell you that they are nothing but toys that don't have any real power. They may say that this is nothing but a fad and that if you genuinely want to develop applications, you need to use traditional programming languages.

Simultaneously, many businesses see these no code tools as a distraction, which takes their employees away from their tasks and duties. Rather than writing reports and filling out spreadsheets, these people waste their time making shiny phone apps that don't solve real problems or create bonafide value.

To be fair, these perspectives were once very valid. But in recent years, the no code landscape has significantly changed, and the gap between no code and traditional development tools has been shrinking. As the no code tools have been improving, the value that they bring to business has also been increasing.

Ironically, these two arguments are incredibly similar to statements that were used in the earlier days of computing. But they weren't talking about no code tools at that time. They often referred to flashy programming interfaces and upstart programming languages such as Visual Basic or JavaScript because real developers wrote in low-level machine language!

Many of these "distracting" toys are now valuable tools. For example, JavaScript was once just a tool used to create dynamic web pages. Now, tools written with JavaScript, such as Node.js, which is used by millions of developers worldwide, or jQuery, which can be found in over 75% of the websites on the internet, have proven how a once simple, niche idea can have a profound impact.

But there is a third perspective. These are the people who have embraced no code tools and see the potential that they truly offer. No longer is the business handcuffed to expensive developers or left to be dissatisfied with an off-the-shelf software package that performs some of the functions you require, but not really.

Instead, the worker who does the task every day has the power to use these no code tools to reduce their workload, increase their productivity, and reduce human error through data validation, automation, and eliminating repetitive tasks.

And because the worker is developing a solution, this end product can often quickly and accurately create value compared to a more expensive custom solution created by a developer who does not truly understand the role that this employee plays within the organization. No code tools are quicker to develop, cheaper to own, and often more efficient than development big brothers.

There is one final point about developing applications with no code tools. Because the barrier to entry is so much lower than complete development suites, tasks that would have otherwise been too cost-prohibitive to automate now become something that the employee can realize programmatically, by themselves.

Outside of daily business, we are starting to see a whole new class of entrepreneurs developing before our eyes on the internet. These are people who identify problems in day-to-day life and identify a win-win situation for both themselves and others. They are then using these no code tools to create applications and full-blown systems to solve these problems.

These entrepreneurs have also discovered that because the cost to develop these applications is so minimal and the time to market from initial concept to production is relatively short, a whole new way of building businesses has emerged. Rather than come up with an idea and put all of their time and effort into making that idea successful without knowing whether it will be successful in the end, these entrepreneurs are taking a different approach.

They will build several businesses simultaneously, some as many as 200 in one calendar year. This way, the entire market is their testing ground. They might try different strategies with different products, and instead of putting their heart and soul into one thing, they treat these businesses like cattle. The ones that grow strong and have a good return on investment are groomed and fed. The companies that don't produce or end up taking more time and energy than they are worth are taken out back and dealt with accordingly. No tears are shed for the failed business because the lost time/effort/money is minimal. The entrepreneur is too busy either growing the successful companies or returning to their no code tools to start the next one.

Now that we have a better understanding of the importance of no code tools in our modern businesses and day-to-day lives, let's take a closer look at a couple of these tools to understand some of their capabilities better.

 

An introduction to n8n

n8n is one of these no code tools. n8n's primary purpose is to connect different types of systems to share information in a meaningful way.

On its surface, that statement may sound like a relatively trivial thing that would have minimal impact on day-to-day work. But, when you start to dig a little deeper into how we do tasks and complete our work, you will quickly realize that there are many little jobs that we repeatedly do over and over again. If we can find a way for a system such as n8n to perform these little tasks for us, the cascade effect is more significant than just the time saved with that one task.

You also save the transition time between jobs. Many researchers have looked at context switching or how long it takes for us to transition from one task to another. They have discovered that it takes approximately 20 minutes to shift from doing one type of work to another. If you have one fewer job to do, that's one shift between tasks not needed, saving you that 20-minute transition time. There is also the time that's lost while waiting for something to happen.

If, for example, you have to fill out an online form with a set of information, such as a username and a password, and then wait for an email to come in after you have submitted the form, you have lost that time between hitting "submit" and waiting for that email to arrive. Instead, if you were to configure n8n to use an API connection to submit this data, not only would you not have to wait for the email to come in, you wouldn't even have to enter the data in a web form. n8n could perform this entire set of tasks on your behalf in a fraction of the amount of time it took you to fill out the form and wait for the email, all while you could have been doing something else far more critical. Now, imagine you have to do this 80 times a day. Wouldn't you rather spend that time figuring out how to get your computer to do it for you? I think you would.

n8n is a web-based tool. n8n can run on a computer system as small and inexpensive as a Raspberry Pi. It can connect to several hundred different systems with nodes designed explicitly for those systems and thousands more that use standard REST API interfaces. It can also manipulate the data that it receives and sends out so that the information in each system does not have to be identical when moving data around. It can also produce some analytics, providing insights into the information that's returned from the processed data. And because it can interface with almost any REST API-based system, this means that the only limits to its capabilities are the limits of those other systems. Do you want any of them to be able to create 3D images? There's a system with an API for that. Do you want n8n to be able to remix music on the fly based on the color patterns it sees coming in from a webcam? There's a workflow for that. Would you like n8n to automatically balance your business's books to provide you with a real-time dashboard of the fiscal health of your organization? There are ways to do that as well. If there is a way to connect n8n to a system, then n8n can inherit those powers.

While each of these nodes is very powerful in and of itself, the true potential of n8n is evident when you begin to connect them. Each node is designed to perform a specific set of actions. Upon completion, it then passes this information on to the next node. How does a node know where to send its data to next? It simply looks at the connections between the nodes.

Each node has an input (left) side and an output (right) side. If a node's output connects to a second node's input, the second node receives the outcome of the first node as its input. A collection of two or more nodes is known as a workflow.

These workflows can then be saved in the n8n system and activated to run on their own in the background when you do not have the n8n Editor UI open:

Figure 1.1 – Sample n8n workflow

Figure 1.1 – Sample n8n workflow

But how do these workflows know how to run when I don't tell them to run? When the workflow is on my screen in the n8n Editor UI, I can click the Execute Node button to make the workflow run. But if I'm not available to click the button, how does it know to run? Now is the time for the trigger nodes to shine!

In general, the trigger node starts a workflow. The first one is the Cron node. The Cron node gets its name from a Linux service that executes commands at specifically scheduled times. The Cron node does the same thing. You specify a time – for example, every day at noon – and the workflow connected to this Cron node will run at that specific time.

What happens if an event occurs between the times you have the Cron node configured to run? Several other trigger nodes come into play. Most of these nodes listen for events coming in from a specific system. When it detects these events, it will take the information that's been sent to it and process it through the workflow connected to that node.

New trigger nodes are added to n8n regularly. But there is still a chance that the specific system you want to listen to does not exist as a node. What do you do now? The answer is to use a webhook node. A webhook node is a generic version of these customized trigger notes. It allows any system to submit an HTTP request to an address on the network to send information to n8n when it's using this node. The webhook node opens up n8n to all kinds of other possibilities.

Now, wouldn't it be great if there was a node much like the webhook node but instead of listening to any system that can make an HTTP request, it could talk to any system listening for HTTP requests? As you may have guessed, that is what the HTTP request node does. This node gives any system the ability to talk with almost any other system with a REST API.

The REST API is an internet standard used for data communication between two systems. More and more developers are writing REST APIs for their new systems and services. Older systems and services are often retrofitted with new APIs to make them more accessible to other data systems.

Now that we have been introduced to n8n and its benefits, let's install it!

Installing n8n

n8n is operating system agnostic, meaning it will run on Mac, Windows, and Linux operating systems. n8n can do this because it runs on top of the Node.js JavaScript library, enabling developers to run JavaScript applications as services.

Note

Just prior to this book going to press, n8n released a new version called n8n Desktop. It installs much more like a typical application rather than a service.

Installing n8n varies from one operating system to the next, but people generally have the most difficulty with Linux. This is primarily because Linux is the clear choice for installations such as cloud service providers or inexpensive home lab scenarios such as Raspberry Pi installations. We have chosen to provide detailed installation instructions for Linux systems, specifically Debian-based systems, because of these challenges. Some examples of Debian-based systems include Ubuntu and Raspberry Pi OS. You can find instructions for other operating systems on the n8n website at https://docs.n8n.io/#getting-started.

Prerequisites

To successfully install n8n on a Linux computer, you will require the following items:

  • A Debian-based Linux operating system
  • A regular user account with sudo access
  • A modern web browser
  • An internet connection

1. Updating the operating system

It is crucial to have an updated operating system to make sure that you are installing the latest version of the software. Perform this by following these steps:

  1. Log into your computer with a standard user account.
  2. At a Terminal, enter the following command to update the system:
    sudo apt install update -y &&sudo apt install upgrade -y
  3. When you're prompted for a password, enter your user password.
  4. The system will then install several packages and updates.
  5. Once the installation is complete, proceed to the next section.

2. Installing the prerequisites

n8n requires several different packages to run correctly. Follow these steps to install these packages:

  1. At a Terminal, enter the following command to install the prerequisites:
    sudo apt install build-essential python -y
  2. If you're prompted for a password, enter your user password.
  3. The system will then install several packages.
  4. Once the installation is complete, proceed to the next section.

3. Installing Node.js

As we mentioned earlier, Node.js is the core upon which n8n is written. Without Node.js, n8n will not run. These instructions will install version 14.x:

  1. At a Terminal, enter the following command to configure the installation source for Node.js 14.x:
    curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash -
  2. If you're prompted for a password, enter your user password.
  3. Enter the following command to install Node.js:
    sudo apt install nodejs -y
  4. If you're prompted for a password, enter your user password.
  5. Once the installation is complete, proceed to the next section.

4. Configuring the Node.js environment

For n8n to work properly, it needs to be installed globally on the system. By default, Node.js does not allow you to install n8n globally without configuration changes. Follow these steps to configure the Node.js environment properly:

  1. At a Terminal, enter the following commands to create a new hidden folder in your home directory:
    cd ~
    mkdir ~/.nodejs_global
  2. The following commands configure the npm package manager to use the new folder for global installations:
    npm config set prefix ~/.nodejs_global
    echo 'export PATH=~/.nodejs_global/bin:$PATH' | tee --append ~/.profile
    source ~/.profile
  3. Once the installation is complete, proceed to the next section.

5. Installing n8n

The system is now ready to install n8n:

  1. At a Terminal, enter the following command to start the n8n installation:
    npm install n8n -g
  2. The installation will now proceed to install several packages, along with the n8n application.

    Note

    While n8n is installing, you may encounter several warnings. It is normal to receive them, and you should not be alarmed.

  3. Once the installation is complete, proceed to the next section.

6. Using PM2 to run n8n as a service

n8n typically runs in a Terminal, but as soon as you exit the Terminal or reboot your computer, n8n will no longer run. To solve this issue, we can use an application called PM2 to run n8n as a service. Let's install it:

  1. At a Terminal, enter the following commands to install PM2:
    cd ~
    npm install pm2@latest -g
  2. Once PM2 is installed, use PM2 to start n8n:
    pm2 start n8n
  3. Next, configure PM2 to start n8n automatically if your computer is restarted:
    pm2 startup
  4. The system will now prompt you to execute a command line. Make sure that you enter it exactly as it is presented on the screen.
  5. Finally, save the new PM2 configuration:
    pm2 save

7. Opening the n8n Editor UI

n8n should now be running. You can check that it is running properly by following these steps:

  1. If you don't know your computer's IP address, enter the following command in a Terminal:
    hostname -i | awk '{print $1}'
  2. It will return a value like 192.168.0.1.
  3. Open a web browser and go to http://<IP address>:5678. So, for our example, you would go to http://192.168.0.1:5678.
  4. The n8n Editor UI will open with an empty workflow, as shown in the following screenshot:
Figure 1.2 – n8n Editor UI

Figure 1.2 – n8n Editor UI

With n8n successfully installed, it's time to start building some valuable solutions. But, sometimes, the most challenging part of building a solution is deciding what to make in the first place. Let's explore some ways in which people have used n8n to resolve real-world problems.

 

How do people use n8n to solve problems?

While n8n has many different capabilities, its primary role is connecting systems and preparing the data correctly for each system to ingest.

An excellent way to understand the capabilities of n8n is with a few real-world examples. The following are setups that are being run by real companies, giving them a technical advantage over the competition.

CRM call recording access

One of my former employers had purchased a new Linux-based phone system and a separate Raspberry Pi-based system to record all of the phone calls that came into the organization, along with Windows-based software to manage the recordings. They also had a Windows-based customer relationship management (CRM) system for keeping track of sales and inventory, with a Microsoft SQL Server backend.

The sales division head wanted the sales team to retrieve all the calls that had been made or received from a customer based on date and then click on a button or link to listen to the recording.

The final solution grabbed all of the call log data from the phone system and temporarily stored it in a text file. n8n would then monitor this file for changes and import the data. At this point, it would pull in the call recording information, correlate it with the call logs, and write this data to Microsoft SQL Server. The IT team then modified the CRM to look for this information in the new table and display it in the CRM.

Because n8n is both data- and system-agnostic, it effectively bridged these radically different devices and enabled efficient, accurate communication among all of them. Without n8n, this would have required a series of different scripts, scheduled jobs, file exports, network shares, and constant monitoring. n8n allowed the IT team to perform these same tasks in one single system using only the tools that came with it.

Goomer pivots during COVID-19

Goomer started as a restaurant ordering software company in Brazil. But when COVID-19 struck in early 2020, the government shut down all restaurants, and Goomer's clients were now struggling to stay in business. Goomer's business was suddenly in trouble.

Goomer decided to become a delivery application, shifting all of their development teams to designing and engineering the new program. Their technical teams did not have time to focus on automation or deployment tools. It was at this point that they decided to turn to n8n to build out this automation.

They chose n8n because it was significantly cheaper and more flexible than other hosted solutions. Because they could run it locally without any surprise billing, they could focus on deploying their tools and running their business without having to worry about scaling or prohibitive pricing.

Goomer uses n8n to manage their business workflow by connecting systems such as Airtable, Coda, and HubSpot. n8n automatically reacts to events in these systems to update data and information in the other systems without relying on any user intervention.

n8n sails the seven seas

n8n isn't limited to dry land. Maranics takes human manual processes and digitizes them to increase the quality of the process and reduce workloads. After using other automation solutions for several years, Maranics started to migrate their automation workflows to n8n for many clients, including several cruise ships.

Maranics used n8n to easily connect different databases such as MongoDB and Postgres to other systems with standard REST APIs, which would have been significantly more difficult using other solutions.

Since n8n can be installed locally in a business (or a ship), there is no need for a persistent internet connection when all the data is stored on systems locally. Plus, there is no need for the data to leave the network or local business since all of the data can be processed right there on-premises.

These are just a few examples of how people have taken n8n and built workflows to make their processes more efficient, less prone to human error, and available 24/7.

It's fascinating to see how people have used n8n to connect systems. But, occasionally, there is no all-in-one system out there that does what you want. Other no code tools step in at this point to fill in the gap. They provide various services such as web frontends or data storage. Then, n8n is used to connect it to the rest of the world. Bubble is one of those tools, and we will be using it extensively throughout this book.

 

An introduction to Bubble

Because n8n's forte is integrating different systems, the development team at n8n has not focused on user interface development. The development team knows that entire companies focus on excellent no code tools for building that frontend and are happy to leave that to them. (Although, we will show you how to make a web frontend entirely using n8n later in this book.)

Since n8n's focus is not on frontend design, we chose to go with Bubble as the no code development tool for this purpose. Specifically, we decided to use Bubble because of the following reasons:

  • It has a simple and intuitive development interface.
  • It is a popular and well-known no code tool.
  • It has APIs for both data access and workflow activation.
  • It has limited workflow functionality.
  • It has little integration with other systems.

These factors make it an excellent tool to use. But it is not the only tool that we could have used to interact with n8n. There are very few no code tools that n8n cannot connect with, using a custom-designed node or a REST API.

 

Summary

This introductory chapter explored no code and the people who make it a driving force for change in present-day businesses. We also discussed some of the significant benefits of using tools such as n8n and provided some real-world examples of how companies have leveraged no code's flexibility.

We also took some necessary first steps toward understanding n8n a bit better. You learned how to install n8n on a Debian-based Linux system so that you can get started right away with using n8n at your home or business at no cost to you.

Finally, we introduced you to Bubble, a no code tool that we will be using to develop frontends for many of our example applications. We'll be able to use Bubble and n8n in tandem to create full-fledged solutions that are user-friendly (Bubble) and interact with various systems and services.

Now that you have a better understanding of no code, n8n, and Bubble, it's time to dig deeper into how n8n works and build some of our first workflows. We will do this in the next chapter.

About the Authors
  • Jason McFeetors

    Jason McFeetors works as a senior management consultant for a large IT consulting firm in Canada, where he is presently working with a team designing and building cloud-based call center solutions. Jason has been working in the IT industry for over 25 years and has worked at nearly every level in the industry, from support tech to system architect to chief technology officer. His love for all things tech takes him to all sectors of the industry, including software development, hardware design, automation, and IoT. His work has previously been featured in Popular Science and Lifehacker.

    Browse publications by this author
  • Tanay Pant

    Tanay Pant is an author, speaker, and developer relations expert. He has written the books Learning Web-based Virtual Reality, Building a Virtual Assistant for Raspberry Pi, and Learning Firefox OS Application Development. He has been listed in the about credits of the Firefox web browser for his contributions to the different open source projects of the Mozilla Foundation. He also writes for several websites, such as SitePoint and Tuts+, where he shares tips and tricks about web development.

    Browse publications by this author
Rapid Product Development with n8n
Unlock this book and the full library FREE for 7 days
Start now