---
description: Running Flan project in your local machine.
---

# 3. Running Flan in local

## Creating your Golem Virtual Machine

{% hint style="info" %}
This step is only necessary if you want to create a new Golem VM, if no you can still use the once already pushed to Golem using the hash present in the flan-api project.
{% endhint %}

First let's open a console and locate it into the flan-docker project folder, to build and publish a docker image:

```bash
# Let's locate in the flan-docker folder
cd packages/flan-docker

# Build docker vm
docker build -t nestorbonilla/flan-image .

# Push vm to docker hub
docker push nestorbonilla/flan-image
```

Once we have our Docker image in docker hub, let's convert it to a golem VM:

```bash
# First time wil compile a new vm image
gvmkit-build nestorbonilla/flan-image:latest --push

# Second time will push the vm image to golem
gvmkit-build nestorbonilla/flan-image:latest --push
```

The result of the last command will be the **hash** of the Golem VM, and you will need to use it to refer to your VM in your implementation.&#x20;

## Run Flan project

Flan contains three separate projects:

* flan-api
* flan-docker
* flan-app

We already used flan-docker to publish our own Golem VM, now let's run the other two to interact with our app.

```bash
# let's install dependencies
yarn install

# run flan-app
yarn start

# run flan-api
yarn golem
```

## Running Yagna Daemon

{% hint style="info" %}
If you have not installed Yagna, you should follow the instructions of the [following link](https://handbook.golem.network/requestor-tutorials/flash-tutorial-of-requestor-development) before continue.
{% endhint %}

To run in local we will need to send our tasks to Golem via through a Yagna daemon. For this we will need to have two consoles:

{% code title="CONSOLE 1" %}
```bash
# run yagna daemon
yagna service run
```
{% endcode %}

{% code title="CONSOLE 2" %}
```bash
# removes previous account data
rm -rf $HOME/Library/Application\ Support/GolemFactory.yagna

# check there's no accounts
yagna app-key list

# generates a new requestor account
yagna app-key create requestor

# export required environment variable with the generated account
export YAGNA_APPKEY=insert-your-32-char-app-key-here

# fauce funds for the created account
yagna payment init -r
yagna payment init -r --driver=NGNT

# verify funds
yagna payment status
```
{% endcode %}

{% hint style="info" %}
Before running Yagna service I recommend clean previous account data.
{% endhint %}

## Send tasks to Golem Virtual Machine

Now we're ready to send our tasks to Golem, so open our browser and go to:

{% embed url="http://localhost:3000" %}

Here we just need to select our parameters:

* first year
* last year
* country
* count

Then click on the button "Calculate with Golem", and now let's wait for Golem to distribute the task and execute it. Once it concludes you should see a new plot image that represents a BCG Growth-Share Matrix of the selected country between the years you have chosen. This will helps entrepreneurs to have a recommendation on what sector do they would need to research more if they want to start a new initiative, all this based on all the exports and imports happening worldwide compared with the current country, such a deal!

Thanks for reaching the end! 🙌🏻
