> For the complete documentation index, see [llms.txt](https://nestorbonilla.gitbook.io/flan/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://nestorbonilla.gitbook.io/flan/3.-running-flan-in-local.md).

# 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! 🙌🏻


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://nestorbonilla.gitbook.io/flan/3.-running-flan-in-local.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
