# Build executables and run manually

If you want to manually build every component with debug information, then build and run the services and packages in the following sequence: Interfaces, Logger Helper, Message Broker, Logger Service, Auth Service, IPFS, Guardian Service, UI Service, and lastly, the MRV Sender Service. See below for commands.

### Prerequisites for Manual Installation

* [MongoDB](https://www.mongodb.com/) ,
* [NodeJS](https://nodejs.org/)
* [Yarn](https://classic.yarnpkg.com/lang/en/docs/install/)
* [Nats](https://nats.io/)

#### Build and start each component

Install, configure and start all the prerequisites, then build and start each component.

#### Services Configuration:

* for each of the services create the file `./<service_name>/.env` to do this copy, past and rename the file `./<service_name>/.env.template`

  For example:

  in `./guardian-service/.env`:

  ```plaintext
      GUARDIAN_ENV="develop"
  ```

  If need to configure OVERRIDE uncomment the variable in file `./guardian-service/.env`:

  ```plaintext
      OVERRIDE="false"
  ```
* configure the file `./<service_name>/configs/.env.<service>.<GUARDIAN_ENV>` file: to do this copy, past and rename the file `./<service_name>/.env.<service>.template`

  following previous example:

  in `./guardian-service/configs/.env.guardian.develop`:

```plaintext
OPERATOR_ID="..."
OPERATOR_KEY="..."
```

* Setting up Chat GPT API KEY to enable AI Search and Guided Search:

  For setting up AI and Guided Search, we need to set OPENAI\_API\_KEY variable in `./ai-service/configs/.env*` files.

  ```
  OPENAI_API_KEY="..."
  ```

***NOTE:*** Once you start each service, please wait for the initialization process to be completed.\*\*

1. Clone the repo

```
git clone https://github.com/hashgraph/guardian.git
```

2. Install dependencies

```
yarn
```

3. Build ***@guardian/interfaces*** package

```
 yarn workspace @guardian/interfaces run build
```

4. Build ***@guardian/common*** package

```
yarn workspace @guardian/common run build
```

5. Build and start ***logger-service*** service

To build the service:

```
 yarn workspace logger-service run build
```

Configure the service as previously described. Do not need special variables configuration.

To start the service:

```
yarn workspace logger-service start
```

6. Build and start ***auth-service*** service

To build the service:

```
yarn workspace auth-service run build
```

Configure the service as previously described. Do not need special variables configuration.

To start the service:

```
yarn workspace auth-service start
```

{% hint style="info" %}
**Note:** For correct start of auth-service it is necessary to fill in JWT\_PRIVATE\_KEY and JWT\_PUBLIC\_KEY, which are RSA key pair. You can generate it in any convenient way, for example, using this service <https://travistidwell.com/jsencrypt/demo/>.
{% endhint %}

{% hint style="info" %}
**Note:** For password validation used 2 variables MIN\_PASSWORD\_LENGTH and PASSWORD\_COMPLEXITY.\
MIN\_PASSWORD\_LENGTH sets the minimum password length. Default value is 8, minimum value is 1.\
PASSWORD\_COMPLEXITY sets the password complexity level. Available values: easy, medium, hard

* easy: no rules
* medium: one uppercase letter, one lowercase letter, one number
* hard: one uppercase letter, one lowercase letter, one number, one special character

Default value is medium
{% endhint %}

7. Build and start ***policy-service*** service

To build the service:

```
yarn workspace policy-service run build
```

Configure the service as previously described. Do not need special variables configuration.

To start the service:

```
yarn workspace policy-service start
```

8. Build and start ***worker-service*** service To build the service:

```
yarn workspace worker-service run build
```

Configure the service as previously described. Update **IPFS\_STORAGE\_API\_KEY** value in `./worker-service/configs/.env.worker` file.

To start the service:

```
yarn workspace worker-service start
```

9. Build and start **notification*****-service*** service

To build the service:

Yarn:

```
yarn workspace notification-service run build
```

Npm:

```
npm --workspace=notification-service run build
```

Configure the service as previously described. Update **OPERATOR\_ID** and **OPERATOR\_KEY** values in `./guardian-service/configs/.env.worker` file as in the example above.

To start the service (found on [http://localhost:3002](http://localhost:3002/)):

Yarn:

```
yarn workspace notification-service start
```

Npm:

```
npm --workspace=notification-service start
```

10. Build and start ***guardian-service*** service

To build the service:

```
yarn workspace guardian-service run build
```

Configure the service as previously described. Update **OPERATOR\_ID** and **OPERATOR\_KEY** values in `./guardian-service/configs/.env.worker` file as in the example above.

To start the service (found on [http://localhost:3002](https://localhost:3002)):

```
 yarn workspace guardian-service start
```

11. Build and start ***api-gateway*** service

To build the service:

```
yarn workspace api-gateway run build
```

Configure the service as previously described. Do not need special variables configuration.

To start the service (found on [http://localhost:3002](https://localhost:3002)):

```
yarn workspace api-gateway start
```

12. From the **mrv-sender** folder

To build the service:

```
npm install
npm run build
```

Configure the service as previously described. Do not need special variables configuration.

To start the service (found on <http://localhost:3005>):

```
npm start
```

13. **From the ai-service folder**

To build the service:

Yarn:

```
yarn workspace ai-service run build
```

Npm:

```
npm --workspace=ai-service run build
```

Configure the service as previously described. Do not need special configuration variables.

Yarn:

```
yarn workspace ai-service start
```

Npm:

```
npm --workspace=ai-service start
```

14. From the **frontend** folder

To build the service:

```
npm install
npm run build
```

To start the service (found on <http://localhost:4200>)

```
npm start
```

Browse to <http://localhost:3000> and complete the setup. To get more info, please check: [Launching Guardian](/guardian-dev/guardian/readme/getting-started/installation/launching-guardian.md)


---

# Agent Instructions: 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://guardian.hedera.com/guardian-dev/guardian/readme/getting-started/installation/build-executables-and-run-manually.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.
