In this page, you follow a tutorial which builds, runs, modifies, and deploys a
DApp called Animal Kingdom. Through this exercise, you'll learn about the
components of a Blockstack Dapp. You'll also learn about the technical
requirements for submitting a DApp for App.co. This page contains the following
topics
* TOC
{:toc}
<divclass="uk-card uk-card-default uk-card-body">
<h5>Can you skip this page?</h5>
<p>It isn't a good idea to skip this page, requirements for DApps that participate in App Mining are covered. So, everyone should at least skim through this page.
</p>
</div>
### Skills you need to build Animal Kingdom
This tutorial is designed for a wide audience. Anyone with access to a Windows,
Mac, or Linux computer and some familiarity with a command line can build the
Animal Kingdom DApp.
If you are good at following directions, chances are you can complete this
tutorial even if you have no programming experience. Knowledgeable developers
should easily be able to complete the tutorial within an hour by following
You are prompted to agree to the terms of service.
4. Agree to the terms of services.
The tools are installed. This is fairly quick depending on your connection speed.
### Install Node Package Manager (NPM)
{:.no_toc}
Open source developers from every continent use NPM to share software components
called packages. The Animal Kingdom uses React, Babel, and many other
components. You'll use the `npm` command to install these packaged components.
1. Open a terminal window on your system.
2. Verify you have installed `npm` using the `which` command.
<imgsrc="images/command-line.png"alt="">
If `npm` is installed, `which` returns the command's location in your environment.
3. If the `npm` command is not in your system, <ahref="https://www.npmjs.com/get-npm"target="\_blank">install it using the instructions for your operating system</a>.
The following table describes the key interactions and screens in the DApp.
<tableclass="uk-table uk-table-striped">
<tr>
<th>Click to enlarge</th>
<th> Description</th>
</tr>
<tr>
<td><divuk-lightbox="animation: slide">
<aclass="uk-inline"href="images/kingdom-enter.png"data-caption="Users must login with a Blockstack identity.">
<imgsrc="images/kingdom-enter.png"alt="">
</a>
</div>
</td>
<td><p>Users log in (authenticate) with a Blockstack identity. By authenticating, the user gives the application the ability to get and put data in the user's Gaia storage hub.</p></td>
<td><p>The Blockstack login dialogs are part of the Blockstack Browser which is itself
a DApp. Once a user authenticates, the DApp code automatically
returns them to the Kingdom they were attempting to enter.</p></td>
</tr>
<tr>
<td><divuk-lightbox="animation: slide">
<aclass="uk-inline"href="images/kingdom-new.png"data-caption="Choose a persona and territory.">
<imgsrc="images/kingdom-new.png"alt="">
</a>
</div></td>
<td><p>First-time visitors to a kingdom are prompted to create an animal persona and
a territory to rule. Once they make a selection, users click <strong>Done</strong> to create a
kingdom to rule. Behind the scenes, the data about the user's selection is stored in the user's GAIA hub.
</p>
</td>
</tr>
<tr>
<td><divuk-lightbox="animation: slide">
<aclass="uk-inline"href="images/kingdom-choices.gif"data-caption="Choose a persona and territory.">
<imgsrc="images/kingdom-choices.gif"alt="">
</a>
</div></td>
<td><p>Each kingdom has animals and territories. Users can edit their original persona/animal combination. You'll learn how to modify the Animal Kingdom code to add new animals and territories.</p></td>
<p>Users can add subjects from territories in their own Animal Kingdom. The DApp updates the user's GAI hub each time the user adds a subject. Users can also visit other Animal Kingdom installations and add subjects from these as well. You'll learn how to modify the <b>Other Kingdoms</b> available in your installation.
In this section, you copy the code for Animal Kingdom to your workstation.
1. In your browser (Chrome, Safari, etc), <ahref="https://github.com/blockstack/animal-kingdom"target="\_blank">open the Animal Kingdom code repository</a>.
The AnimalKingdom code is kept in a public GitHub repository.
2. Click the **Clone or download** button.
If you have a GitHub account you can choose to clone the original repository
or fork it and then clone it. These instructions assume you are downloading
the code.
3. Choose the **Download ZIP** for Animal Kingdom.
<imgsrc="images/kingdom-copy.png"alt="">
3. Check your download directory for the `animal-kingdom-master.zip` file.
4. Copy the download zip file to a directory where you keep code projects.
node-pre-gyp WARN Tried to download(404): https://fsevents-binaries.s3-us-west-2.amazonaws.com/v1.2.4/fse-v1.2.4-node-v67-darwin-x64.tar.gz
node-pre-gyp WARN Pre-built binaries not found for fsevents@1.2.4 and node@11.1.0 (node-v67 ABI, unknown) (falling back to source compile with node-gyp)
SOLINK_MODULE(target) Release/.node
CXX(target) Release/obj.target/fse/fsevents.o
In file included from ../fsevents.cc:6:
...
added 1390 packages from 766 contributors and audited 15238 packages in 16.11s
found 1 high severity vulnerability
run `npm audit fix` to fix them, or `npm audit` for details
$
```
This command creates a `node_modules` subdirectory to your project code and
installs all the code libraries you need for your Animal Kingdom project.
3. Enter the `ls` command to list the contents of your project directory to verify `npm` installed correctly.
```
$ ls
```
The `node_modules`directory contains many core libraries used by Animal
Kingdom. For example, the Blockstack Javascript library is in the
`nodule_modules/blockstack/lib` subdirectory.
4. Start the Animal Kingdom DApp running on your workstation by entering:
```bash
npm start
```
The `npm` program compiles the Animal Kingdom code. Once the code compiles,
the DApp opens Animal Kingdom running at the `http://localhost:3000` URL in
your browser.
4. From the initial Animal Kingdom screen, choose an animal person and a territory.
5. Press **Done** at the bottom of the page.
The Animal Kingdom makes a call to the Gaia hub to store your selection.
After a brief pause, the DApp returns you to the **Your Kingdom** page. If
you have problems, refresh the page and click **Your Kingdom** in the
menu.
<imgsrc="images/kingdom-ruler.png"alt="">
6. Spend a little time exploring the application.
For example, you could edit your animal or visit the other pages such as **Animals** or **Territories**.
<p>To participate in application mining your application must be available for review. Open source projects must provide the URL to their code. Projects with private repositories can provide their application in a package form.
this section, you use a free GitHub account to add your kingdom to the
Blockstack kingdom.
1. If you have a GitHub account, go to step 2 otherwise go to GitHub <ahref="https://github.com/"target="\_blank">site and create a new account</a>.
2. Go to the <ahref="https://github.com/blockstack/animal-kingdom/issues"target="\_blank">https://github.com/blockstack/animal-kingdom/issues</a> repository on Github.
2. Click **New Issue**.
The new issue dialog appears.
3. Fill out the issue with the URL from Netlify and your Blockstack id.
When you are done, your issue will look like the following:
<imgsrc="images/kingdom-issue.png"alt="">
4. Press **Submit new issue**.
The Blockstack team will add your Netlify kingdom to ours. When we do that, we will notify you on the issue and you'll also get an email.
5. When you receive the email, login into the Blockstack Animal kingdom to see your kingdom under **Other Kingdoms**.
## Next Steps
{:.no_toc}
Well, you have produced your very first DApp. Congratulations! If you have a
In the next section, you learn how you can participate in App Mining by submitting a [DApp to App.co — the Universal App store](zero_to_dapp_4.html).