Building apps with NocoDB

No Code, No Problem

© Photo by Alexander Sinn on Unsplash

© Photo by Alexander Sinn on Unsplash

Article from Issue 258/2022
Author(s):

NocoDB lets you build useful applications without writing a single line of code.

No-code platforms are all the rage nowadays, and it's not that hard to see why. They make it possible for anyone to create applications for their specific needs in no time and save serious money in the process. Even if you have coding chops, you may find a no-code solution useful for whipping up a quick prototype or a simple application instead of building it from the ground up.

While there are several open source no-code platforms to choose from, NocoDB [1] strikes a perfect balance between functionality and user-friendliness. It's also supremely easy to deploy, which makes it a perfect platform for building simple and more advanced applications.

Deploying NocoDB

The easiest way to deploy NocoDB on a local machine is by using the NocoDB Docker container image. The first step is to install Docker. To do this on Ubuntu and Linux Mint, run:

sudo apt install docker

To be able to run Docker as a regular user, add the current user to the Docker group using the command:

sudo usermod -aG docker $USER

Reboot the machine, and you're done.

Next, create a dedicated directory for storing NocoDB data (e.g., ~/nocodb). This ensures that even when you delete a NocoDB container, your data remains intact.

Finally, run the following command in the terminal (replacing /path/to/nocodb with the actual path to the data directory) to start the NocoDB container:

docker run -d -p 8080:8080 --name nocodb -v /path/to/nocodb:/usr/app/data/ nocodb/nocodb:latest

Upgrading NocoDB

Because NocoDB is deployed as a container, upgrading the platform is a matter of deleting both the container and the image:

docker stop nocodb
docker rm nocodb
docker rmi nocodb/nocodb:latest

You then rerun the command you initially used to start the NocoDB container above to automatically fetch the latest NocoDB image.

Creating a NocoDB Application

Point your browser to 127.0.0.1:8080 (replace 127.0.0.1 with the actual IP address of the machine running NocoDB), and you should see the welcome page. When prompted, create a user account.

NocoDB makes it possible to create a wide range of applications, from a simple task manager to a more complex note-taking tool consisting of several connected tables. Building a note-taking tool as your first project may sound like a daunting proposition, but it demonstrates how easy it actually is to turn ideas into working applications using NocoDB. This project also provides a perfect opportunity to master most of NocoDB's features. In addition to storing notes, this note-taking application project will allow you to attach files to each note, assign tags, and group notes into categories.

The first step is to create a new application and populate it with tables. After you've created an account, NocoDB displays the My Projects dialog (Figure 1). Click New Project and select Create. Give the project a descriptive name and press Create. This drops you into the Team & Auth section, with your owner account automatically added to the project. If you want to invite other users to the project, press New User, add their email addresses, choose the desired role, and press Invite.

Figure 1: Creating a new project in NocoDB.

Now it's time to create tables. Our application needs three tables: Notes for storing notes, Categories for storing notebook categories, and Tags for storing tags.

To create a table, click the Add new table icon (+) next to the Tables entry in the left sidebar. Name the table Notes and make sure that only the id field is enabled under the Add Default Columns section (Figure 2). Press Submit to create the table. This drops you into the Notes table, where your first task is to add the required fields (or columns in NocoDB's terminology). Click the + icon in the table's header row, name the column Title, choose SingleLineText from the Column type drop-down list, and press Save. In a similar manner, add another field named Note, but instead of SingleLineText, choose LongText as the column type. Create yet another column named Attachments with the Attachment column type.

Figure 2: NocoDB makes it easy to populate your application with tables.

The table needs two more columns, but before you can add them, you need to set up two more tables. Create as described a table named Categories. Add a field called Category with the SingleLineText column type. Now, click on the triangle next to the Category field and choose Set as Primary value. This sets the Category column as a unique identifier of each record (or row in NocoDB's terminology). In practical terms, this makes it possible to link from a column in the Notes table to the Category column in the Categories table. If this sounds a bit confusing, don't worry, it will become clear in a moment. Switch to the Notes table, add a new column called Categories, and set its type to LinkToAnotherRecord. Make sure the Many to Many option is enabled, choose Categories from the Child Table drop-down list, and press Save (Figure 3). This creates the Notebook column linked to the Category column in the Categories table.

Figure 3: Specifying a link between columns in different tables.

Use the same procedure to set up a table called Tags. Add the Tag column to the table and set the column as the primary value. Switch back to the Notes table, add a new column called Tags, and set its type to LinkToAnotherRecord. Make sure the Many to Many option is enabled, choose Tags from the Child Table drop-down list, and press Save.

The basic skeleton of the note-taking application is now ready. To test it, switch to the Categories table, and use the Add new row button in the table view to add two or three rows with the desired categories (e.g., Research, Ideas, Scraps, etc.). Add a few rows to the Tags table too. Switch to the Notes table and add a new row. Enter text in the Title and Note fields. To add an attachment, click on the + icon in the Attachments field and select one or more files. Because the Categories field is linked to the Category column in the Categories table, you cannot enter text directly into the Categories field. Instead, click the + icon and you should see a list of the existing values in the Categories table. Click on the desired value to add it to the row in the Notes table. With time, the number of rows in the Categories table can become rather long, but you can quickly locate the desired value by typing its name into the Filter query field and pressing Enter.

If the desired value in the Categories table doesn't exist, you can add it directly from the Link Record dialog. Press + New Record, specify the desired category name, and press Save row.

At this point, the application looks and behaves pretty much like a spreadsheet. The Search field in the top toolbar can be used to quickly find records matching the search term. Using the Sort drop-down list, you can sort rows by the desired field, while the Filter feature allows you to define and apply filtering rules (Figure 4). While you can invite other users to collaborate on the application, you can also share the current view with anyone. This can be useful if you'd like to allow someone to access a specific part of the application without requiring the recipient to register or provide any information. Pressing the Share View button generates a private link that you can share with anyone; you also can protect the view with a password if so desired (Figure 5). Keep in mind, though, that because NocoDB is running on your local machine, the private link only works on your local network. You also need to replace the localhost part of the link shown in Figure 5 with the actual IP address of the machine running NocoDB.

Figure 4: NocoDB lets you create and apply filters.
Figure 5: You can share specific views via private links that can be password protected, if needed.

Finally, using the options available under More, you can export data in a comma-separated file, as well as import existing data into the current table.

The default Grid view is fine for viewing, searching, and sorting rows, but it's less suitable for entering data. This is where the Form view comes into the picture. Select Form under the Create a View section in the right sidebar, give the view a descriptive name, press Submit, and NocoDB generates a ready-to-use form that requires only minor tweaking (Figure 6). Add a title and a short description, and you're pretty much done. Normally, you'd want to include all fields in the form, but if that's not the case, you can hide the individual fields by dragging them off of the form. You can also rearrange the fields in the form by dragging them up or down. It's also possible to configure the form's behavior after the data has been submitted. As with other views, you can share the Form view with anyone, thus giving external contributors the ability to submit data.

Figure 6: NocoDB can generate forms that make data entry easier.

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

  • LibreOffice Music Database

    LibreOffice Calc and Base are all you need to create a simple database for organizing the songs in your music collection.

  • Knoda: Forms & Reports

    Knoda is a user-friendly KDE program that makes database management an intuitive experience. In Part 2 of our workshop, we investigate how to create forms and print reports with Knoda.

  • OpenOffice.org Base

    If you need a quick and easy solution, try building your own database application in OpenOffice.org 2.0.

  • LibreOffice Office Suite

    The LibreOffice Writer word processing tool offers all the basic functionality you expect, along with a couple of features that really make it stand out. We also look at the other LibreOffice components: Calc, Impress, and Base.

  • Migrating Music

    Use a Python API to migrate a music library from SQL to a NoSQL document database.

comments powered by Disqus
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters

Support Our Work

Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.

Learn More

News