Summary

Holochain’s new rapid application development (RAD) tool has landed in the newest blessed release of Holonix, the Holochain developer environment. It saves your fingers by generating a lot of the boring boilerplate for you—not just DNA code itself, but front-end code too! In this edition I’ll give an overview of the tool, walk you through a quick tutorial, then share what’s next and why we’re building this.

Highlights

  • Generate your hApp’s source code in seconds with `hc-happ-scaffold`
  • Holonix v0.0.79 released and blessed
  • Good news for macOS Catalina and Windows 10 developers: installing the dev tools just got easier

Generate your hApp’s source code in seconds with `hc-happ-scaffold`

As promised, our developers have created the second iteration of our rapid application development (RAD) tool. The first iteration was a proof of concept that built a fully functioning note-taking hApp for you to play with and explore. As a next step, this new tool gets you running with a hApp of your own design.

The `hc-happ-scaffold` tool takes a file in which you’ve described the types of data your hApp ought to produce and how they can be manipulated or accessed. From that file it generates a DNA (the ‘Holochainy’ part of your hApp, the source code that defines the ‘rules of the game’) and a sample UI that lets people create, retrieve, edit, and delete that data.

It’s super handy to have your DNA autogenerated for you, of course—nobody likes writing boilerplate code, and entry type definitions in a DNA tend to have a lot of boilerplate. But I found the autogenerated UI to be equally exciting—it meant that I could start playing with my DNA in mere minutes, without typing in arcane terminal commands.

The UI is basic, but it’s useful. In a conversation with Lisa Jetton, co-creator of this tool, I said, “oh, it’s kind of like Swagger UI (an API documentation and live testing tool), but for Holochain?” and she said, “yes, exactly!” If you’ve used an HTTP API with a Swagger UI, you know that it’s a great way of getting familiar with that API, because you can make calls against a running instance and see how they behave. A zome’s public functions are its API, so this UI does roughly the same thing. It hides some of the details behind a CRUD forms interface, but gives you the same immediacy you’re used to with Swagger.

Tutorial: Get your hApp up and running in a few minutes

Make sure you’ve installed Holonix, the Holochain development environment, first.

  1. Enter the Holochain development environment:
nix-shell https://holochain.love

2. Go to a folder where you’d like to create the hApp (create one if you haven’t already):

cd ~/my-holochain-projects

3. Create a ‘type spec’ file—a human-readable file that describes all your entry types. You can read about the format and find a sample type spec here.

4. Point the scaffolding tool at your type spec file and get it to generate your new hApp.

hc-happ-scaffold my-type-spec.json my-new-happ/

5. Go into the new directory and run your hApp. It’ll start the conductor (Holochain runtime) with a development instance of your DNA, the sim2h switchboard server, a web server to serve your UI assets, and a web browser window containing your UI.

cd my-new-happ
npm start

What’s under the hood?

This scaffolding tool creates everything your app needs to get started:

  • DNA source code written in Rust
  • Basic integration tests written in JavaScript
  • A basic form-based UI built with React and Apollo GraphQL
  • Scripting to start the entire app stack (conductor, sim2h server, and UI server)

The zomes in the DNA are fairly straightforward—just structs and entry type definitions for your data types, plus zome functions to create, read, update, delete, and list entries of each type. (Any of these functions are optional for a given entry type; you can specify which ones you do want.) The built-in validation function specifies that only an entry’s author can edit or delete it.

We chose to build the UI with React because it is such a popular framework; it’s likely that developers new to Holochain will already have experience with it. Apollo GraphQL, on the other hand, is emerging as a favourite among both the community and our own hAppy Team because it’s an easy-to-use abstraction that lets you swap out back-end implementations easily. If you’re already using Apollo or GraphQL in your UI, you can look at the generated source code for examples of how we use them.

What’s next?

In the coming months, we plan to include more features:

  • Links and anchors, which will allow you to take full advantage of the DHT as a graph database.
  • More advanced validation rules, such as configurable edit/delete permissions.
  • Ability to generate multi-zome hApps (currently you can only generate multi-zome DNAs, and only if you download the tool directly from the repo).
  • Ability to generate UI and DNA separately (again, you can currently only do this if you download the tool directly from the repo).

Why are we doing this?

As I’ve written before, we’ve always wanted to make it easier for people to build Holochain apps. This isn’t just good for business; it’s part of our guiding vision. We intend to give groups of people the power to conduct their online lives their way, free of third-party control. Holochain and plug-and-play HoloPorts already have the potential to do that by making it easy for people to self-host the apps they use. This means that no group that wants to take charge of their online tools has to learn how to set up, maintain, and protect a web server, with all the complications that go along with that.

But it’s only half of the picture. The other half is knowing what your app is doing and being able to modify it to your own ends. The open-source movement has helped immensely; now you can choose from a huge marketplace of apps whose code can be audited or modified. The Holochain dev community is following suit. And that’s great—if you’re a programmer.

We don’t want to stop there. People aren’t fully empowered by the software they use until they can write ‘rules of the game’ that are appropriate to their context, share them with others, and let them evolve. It should be easy to create apps that embody your group’s needs and norms. We realise this is a big journey through mostly uncharted land, full of excursions, setbacks, and surprises. And it’s going to take the collective effort of programmers, researchers, UX designers, and users beyond the sphere of our little project. But we think it’s necessary if we want to see a world where people’s agency is preserved by “genuinely consent-driven technology”, in the words of one hApp developer.

I’ll be honest: in order to take full advantage of this RAD tool, you’ll probably still need to be a programmer. But it creates a starting point so you can start building your custom logic sooner. And if you’re new to Holochain development, it demonstrates useful idioms in the context of a working app. And it’s one more step in the journey towards end-user empowerment.

Holonix v0.0.79 released and blessed

This release contains the new RAD tool, so you can start using it without fuss. Everything else, including the Holochain version, is the same as Holonix v0.0.75.

Just a reminder that there are known issues with the included conductor, v0.0.49. We expect to release a new version soon with fixes. These issues shouldn’t affect hApps built with the scaffolding tool, as they are related to features that it doesn’t use.

Good news for macOS Catalina and Windows 10 developers: installing the dev tools just got easier

There are two developments in the land of operating systems that have happened to land within weeks of each other, making it much easier for macOS and Windows developers to start using Holochain.

macOS 10.15 (Catalina)

The developers of the Nix package manager, which we use to build our Holonix developer’s environment, have fixed a long-standing installation issue on macOS Catalina. As you may know, Catalina introduced a read-only system volume to protect your OS from unauthorised tampering. This broke Nix, which stores its files in that volume. With this fix, you don’t need any clever workarounds; just install Nix using the following command:

sh <(curl https://nixos.org/nix/install) --darwin-use-unencrypted-nix-store-volume

Then proceed with the installation of Holonix as normal.

Windows 10

The May 2020 update of Windows 10 finally includes Windows Subsystem for Linux 2 (WSL2). This new version of WSL is quite different; it runs a full Linux kernel in a VM and is apparently much faster and more compatible with various Linux tools—including Nix. Once you install this update, you should be able to use Holonix seamlessly without installing VirtualBox and Vagrant. (Which is welcome news if you’ve had trouble accessing the conductor from a web browser.) The Holonix installation guide for Windows will take you through the simplified procedure.

Development status

Latest

  • Holochain Core: 0.0.49-alpha1 (blessed) | Changelog
  • Holonix: 0.0.79 (blessed) | Changelog
  • Tryorama: 0.3.4 (blessed)
  • hc-happ-scaffold: 0.1.0 (blessed) | Project
  • Holoscape: 0.0.9-alpha (contains Holochain Core 0.0.47-alpha1) | Download

Blessed (available via https://holochain.love)

  • Holonix: 0.0.79
  • Holochain Core: 0.0.49-alpha1
  • hc-happ-scaffold: 0.1.0