---
layout: learn
permalink: /:collection/:path.html
image: /assets/img/zero-to-dapp.png
---
# 3 Customize your Animal Kingdom (Windows)
{:.no_toc}
**Zero to DAPP 3 of 4 for Windows (or [MacOS/Linux](zero_to_dapp_3.html))**
In this page, you examine and modify the Animal Kingdom DApp [you built in part
2](zero_to_dapp_2.html). You'll review the underlying code and locate the
portions of it which fulfill the requirements necessary to qualify an
application for App Mining. You'll expand your knowledge of the application by
extending it. Finally, you'll learn how to deploy a DApp.
This page contains the following topics
* TOC
{:toc}
### Before you get started
{:.no_toc}
Before you continue, make sure you can locate the key files and
directories (folders) in your project. You'll need to make sure you have opened
a terminal and have changed directory to the top of your Animal Kingdom project.
If you find it easier to navigate, you can use the Finder as well. Just remember
you'll need the command line to run your project.
## Understand the Animal Kingdom application code
The Animal Kingdom application has two major components, React and Blockstack.
React is used to build all the web components and interactions. You could
replace React with any framework that you like; Blockstack is web framework
agnostic. This section does not explain the React in any detail; The discussion
focuses on the Blockstack Javascript library the DApp instead.
The Blockstack Javascript library is all a developer needs to
create a DApp. It grants the application the ability to authenticate a
Blockstack identity and to read and write to the user's data stored in a Gaia
hub.
### Authenticating user identity
The `src/App.js` file creates a Blockstack `UserSession` and uses that session's
`isUserSignedIn()` method to determine if the user is signed in or out of the
application. Depending on the result of this method. The application redirects
to the `src/SignedIn` page or to the `src/Landing.js` page.
```js
import React, { Component } from 'react'
import './App.css'
import { UserSession } from 'blockstack'
import Landing from './Landing'
import SignedIn from './SignedIn'
class App extends Component {
constructor() {
super()
this.userSession = new UserSession()
}
componentWillMount() {
const session = this.userSession
if(!session.isUserSignedIn() && session.isSignInPending()) {
session.handlePendingSignIn()
.then((userData) => {
if(!userData.username) {
throw new Error('This app requires a username.')
}
window.location = `/kingdom/${userData.username}`
})
}
}
render() {
return (
To participate in application mining your application must integrate Blockstack authentication.
putFile()
stores the data provided in the
user's DApp data store. You can view the URL for the data store from a user's
profile.
If you tested your Animal Kingdom, you can see this on your profile. To see your
profile, go to the Blockstack
explorer and search for your ID:
Use of Gaia storage is not required for application mining. Keep in mind, using Gaia may make data storage easier as it is designed to work in the Blockstack Ecosystem.
.jpg
extension.
For this example, the territory image is saved in the westeros.jpg
file." %}
4. Use the `ls` command to confirm your file appears in `territories` directory and has the correct name.
```bash
PS C:\animal-kingdom-master> ls .\public\territories\
Directory: C:\animal-kingdom-master\public\territories
Mode LastWriteTime Length Name
-a 2/26/2019 6:09 AM 132814 forest.jpg
-a 2/26/2019 6:09 AM 128272 tundra.jpg
-a 2/26/2019 6:31 AM 1087534 westeros.jpg
PS C:\animal-kingdom-master>
```
5. Open the `src\constant.js` file in your favorite editor.
6. Scroll down to the section that defines the **Territories**.
```js
export const TERRITORIES = [
{
id: 'forest',
name: 'Forest',
superpower: 'Trees!'
},
{
id: 'tundra',
name: 'Tundra',
superpower: 'Let it snow!'
}
]
```
7. Add your new territory.
```js
export const TERRITORIES = [
{
id: 'forest',
name: 'Forest',
superpower: 'Trees!'
},
{
id: 'tundra',
name: 'Tundra',
superpower: 'Let it snow!'
},
{
id: 'westeros',
name: 'Westeros',
superpower: 'The Iron Throne!'
}
]
```
8. Save and close the `constant.js` file.
9. Back in a terminal window, restart your application.
```bash
c:\animal-kingdom-master> npm start
```
10. After the application starts, navigate to the **Territories** page and look for your `Westeros` territory.
## Add the Blockstack kingdom to Other Kingdoms
Your Animal Kingdom only recognizes two **Other Kingdoms**. In this section,
you add a third, the Blockstack kingdom (`https://animalkingdoms.netlify.com`).
1. Open the `src/constant.js` file in your favorite editor.
On Windows you can use Notepad.
2. Scroll down to the section that defines the **Other Kingdoms**
```js
export const OTHER_KINGDOMS = [
{
app: 'https://animal-kingdom-1.firebaseapp.com',
ruler: 'larry.id'
},
{
app: 'http://localhost:3001',
ruler: 'larz.id'
}
]
```
To add a kingdom, you need its URL and the ID of its owner.
3. Edit the file and add the `https://animalkingdoms.netlify.com` which is owned by `moxiegirl.id.blockstack`.
When you are done the file will look like this.
```js
export const OTHER_KINGDOMS = [
{
app: 'https://animal-kingdom-1.firebaseapp.com',
ruler: 'larry.id'
},
{
app: 'http://localhost:3001',
ruler: 'larz.id'
},
{
app: 'https://animalkingdoms.netlify.com',
ruler: 'moxiegirl.id.blockstack'
}
]
```
4. Save and close the `constants.js` file.
5. Back in your browser, navigate to the **Other Kingdoms** page.
6. Go to the `moxiegirl` kingdom by clicking on her kingdom.
7. Try adding a subject from Moxiegirl's kingdom to yours.
## Deploy your DApp on the web
So far, you've been running the application locally. This means you are the only
person that can use it to create a kingdom. You can make your application
available to others by hosting it out on the internet. You can do this for free
with a Netlify account.
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.