1 Comment

Self-Hosting Your Own Cloud – Part 3: Note-taking with Nextcloud & Syncthing

In my previous post, I described how to set up an SMB file server with automated backups using Rsync/Rclone. In this post, we’ll be setting up a privacy-focused alternative to cloud note-taking services like Apple Notes, Evernote, or Google Keep.

This is the third post in a series about protecting your privacy by self-hosting while attempting to maintain the conveniences of public cloud services. See the bottom of this post for a list.

Enjoy Convenience with Privacy

Storing your notes in a cloud provider might be convenient, but there are major privacy concerns, as I have mentioned before. In addition, you are subject to vendor lock-in. If the cloud app/service decides to shut down, your notes are either gone, or you are forced to export them to another provider. Or in the case of paid services, your notes can essentially be held ransom until you pay to continue the service.

We can achieve nearly the same convenience of cloud-based notes solutions with the privacy of our own network.

Use Markdown as a Simple Format

I have switched to note-keeping using Markdown. This frees me from proprietary formats used by note-taking applications and allows me to use the editor of my choosing.

I am currently using Visual Studio Code for note-taking because I enjoy it for writing code and it is available on practically any platform (macOS, Linux, Windows). Of course, you can use any editor you choose such as Emacs, or even those specifically designed for Markdown.

In addition to its simple text-only format, it also has an advantage of being stored simply as files in a directory structure of your own choosing. No databases or complex structures are required here.

This is a win for longevity of data, as you could easily find or search through files in the directory tree even decades from now and find what you want.

Set Up Syncthing

Syncthing is a very powerful open-source tool that lets you keep files up-to-date with changes made across multiple devices.

I’ve got Syncthing set up on my MacBook Pro, my Windows 10-based workstation at home, and my LTE Surface Go. If you are running an Android phone, there is also an app available for that. I am currently using an iPhone, and so far there is no support on that side, unfortunately. We will, however, be using Nextcloud as an alternative for iPhone support (see the next section).

I have a Notes directory that I sync across my devices. If I need to make a note of something while I am at work, for example, I simply type into a Notes log file. Within seconds, it automatically shows up on my computer at home and all of my other devices where I have set up Syncthing.

Syncthing actually doesn’t require any special connection (VPN or otherwise) to sync files across the internet. It can use relays to accomplish this, and the data is encrypted. However, in our case, since we have connection directly into our network, we can disable the following settings in Syncthing:

  • Enable NAT traversal
  • Global Discovery
  • Enable Relay
  • This is just another level of safety that keeps your information from passing through unknown machines out on the internet.

    Syncthing works with all files, not just Notes. I have a couple of RetroPie-based systems set up for emulation, and I use Syncthing on those systems to sync my saved-game and save-state files across them. Be creative!

    While Syncthing runs on the command-line with a local web-based front-end, there are a couple of nice GUI wrappers that you might want to try:

    As an added bonus, I’ve set up a scheduled task to git add and git commit files in my Notes directory hourly. If I accidentally delete something within my Notes file, I can go back and recover what I might have lost.

    Take Advantage of Nextcloud

    Nextcloud is a self-hosted cloud private server that provides quite a large amount of functionality including file access, calendars, and email. It is extensible through many add-ons.

    I installed Nextcloud on my workstation at home, which also acts as my primary server. Nextcloud provides a web interface that you can connect to locally and over your VPN.

    For this blog post, we will be using one of Nextcloud’s simplest features, Files. I simply configured Nextcloud to point to my Notes directory. This allows me to access the same set of directories and Markdown files that are being synced to all my devices using Syncthing.

    Using the Nextcloud iPhone app, you can connect to the local IP address on your network. You can then access the same Note files and make changes as needed. Nextcloud saves the files to your server. Since they are simple files and a directory, Syncthing picks up on these changes and syncs them across my devices.

    What’s Next?

    This is another important step on the self-hosting journey. We have now set up another value-added service where we have control and privacy.

    Later in this series, I’ll cover setting up and hosting alternatives to Google Photos, Gmail, and others. See below for a list of the upcoming posts.

    Upcoming Posts

    This is the third in a series about protecting your privacy by self-hosting, while attempting to maintain the conveniences of public cloud services.