This documentation is for the prototype version of Holochain, written in Go.
There is a new version under development, for which there is new documentation and a Developer Preview pre-release.
View the future of Holochain here.
The documentation for the holochain-proto version will remain available online.

Introduction

With familiarity with the command line tools already, we can cover how a Holochain application is structured, configured, and built. Most fundamental to this is what we call the application "DNA". It's how you configure a Holochain application, and it's covered in detail here.

Every Holochain application is simply a folder with files, and which contains at least a folder called "dna" with a single DNA file in it, called dna.(json, yml, toml). It can be written in JSON, YAML, or TOML. The DNA file acts as an entry point to run your application, and every functional aspect of your app will have to be referenced in it. Like DNA itself, it is a set of instructions.

The DNA file specifies many things, such as application name, which version it needs, and configuration of the "DHT", but most importantly it defines the relevant schemas for data, and functions which perform operations in an app. Furthermore, Holochain defines a way to break down your app functionality into modules, which are called "Zomes", and this is fundamental to your DNA. To make this more clear, here is an example folder structure showing only the DNA parts of a Holochain application:

FolderWithAppName

dna

dna.json

FolderWithZomeName

ZomeName.js

DataSchemaDefinition.json

FolderWithOtherZomeName

OtherZomeName.zy

OtherDataSchemaDefinition.json

As this folder demonstrates, a Holochain app can have multiple Zomes. Each Zome can be written in any of the Holochain supported languages (JavaScript and Zygomys/Lisp currently). A Zome will be ignored unless it is entered into the dna.* file.

When developing an application, we will have to interact with the dna.* file regularly, and forgetting about it will be a source of grief, so watch out! Below is the complete documentation reference for properties you can specify in the DNA file.

Depending on which language you choose, JSON, YAML, or TOML, your syntax will look a bit different, but the properties are the same.

Properties

A UUID will make sure your new Holochain is unique and doesn't accidentally collide with the Holochain whose code you have cloned. For example, if you want to create a new and different instance of a chat application, you can clone the DNA of a chat, and the fact that we generate a new UUID for you, will keep you from accidentally creating a new chat team in the same data-space/DHT as your old one. Thus, when creating a new app, you should use the hcdev init --clone <source-app> rather than simply copying the files manually.

Defines which sources are authorized to call this function. If you do not want a function in your file to be callable by any zomes, or anywhere externally, simply do not list it in the Zomes. Functions section of the DNA. Options: if Exposure is left off entirely as a property, the function defaults to being usable only by other zomes in the app. If set to public, the function is callable over the webserver.

The file name of schema or language schema directive (e.g. "blogpost.json"). You can leave this out of the DNA if there is no schema file (for cases where ZomeEntryType.DataFormat is type string or links). The file specified must be located within the Zome folder.