> For the complete documentation index, see [llms.txt](https://starterpack.onest.network/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://starterpack.onest.network/learn/integration-of-adaptors/beckn-protocol-server/installation.md).

# Installation

### Setup Videos

| Mode             | Video Link                                                                                             |
| ---------------- | ------------------------------------------------------------------------------------------------------ |
| BAP Mode Setup   | <https://www.loom.com/share/daec8556ddb74a65a893fd67d862b805?sid=fb24a0af-49a3-4c66-bf5a-e0a16389b8f1> |
| BAP Mode Testing | <https://www.loom.com/share/0cda9a05ab824ce288a82319155377f3?sid=339a4707-b4bb-43ff-81ba-d6e047d62945> |
| BPP Mode Setup   | <https://www.loom.com/share/b320e436e5c04a529f1133a4f1f42c0a?sid=cc0e5fe7-95ba-41c2-9729-7b41c8328f4d> |
| BPP Mode Testing | <https://www.loom.com/share/37311b91bef747959a59420612a64a68?sid=df35c0cc-703d-4852-b87e-df7a690eea8e> |

### Pre-requisites

* Docker version 20.10 or above ([setup guide](https://docs.docker.com/desktop/))

### Infra Requirements:

2 CPU, 8GB RAM - Ubuntu&#x20;

### Installation

1. Go to the root path (`~/`) in your system and clone this [repository](https://github.com/ONEST-Network/protocol-server).

```sh
git clone https://github.com/ONEST-Network/protocol-server.git
cd protocol-server
git checkout master
```

2. Run below command to configuration, docker, shell scripts files to root(\`\~/\`) path. Following are the   file that will be copied: `deploy-bap.sh, deploy-bpp.sh, default-bap-client.yml, default-bap-network.yml, default-bpp-client.yml, default-bpp-network.yml, docker_data/docker_compose.yaml`

```sh
bash setup.sh
```

3. Go to docker\_data directory and run docker command.

```sh
cd ~/protocol-server/docker
docker-compose up -d
```

4. If sandbox registration is not done, Follow the steps [Generate Keys](/learn/integration-of-adaptors/beckn-protocol-server/generate-keys.md) to generate key pairs that will be used in registry entry and follow [Join the network](/onboarding-sandbox-registration.md)to register.
5. Update the client and network server configuration by following below setups:&#x20;

**For BAP:**

* In the BAP Client and BAP Network codebases, update the `~/default-bap-client.yml` and `~/default-bap-network.yml` file with the following values:

  * Private Key: Copy the private key of your participant.

  * Public Key: Copy the public key of your participant.

  * Use the Registry  lookup API to get the `subscriber id`, `subscriber url` and `unique key` .

    ```
    curl --location 'https://sandbox.onest.network/onest/lookup' \
    --header 'Content-Type: application/json' \
    --data '{
        "country": "IND",
        "type":"BAP"
    }'
    ```

  * Subscriber ID: Get using registry lookup API

  * Subscriber URI: Get using registry lookup API

  * Unique Key: Get using registry lookup API

  * Registry URL: `https://sandbox.onest.network/onest`

&#x20; **For BPP:**

* In the BPP Client and BPP Network codebases, update the `~/default-bpp-client.yml` and `~/default-bpp-network.yml` file with the following values:

  * Private Key: Copy the private key of your participant.

  * Public Key: Copy the public key of your participant.

  * Use the Registry  lookup API to get the `subscriber id`, `subscriber url` and `unique key`.

    ```
    curl --location 'https://sandbox.onest.network/onest/lookup' \
    --header 'Content-Type: application/json' \
    --data '{
        "country": "IND",
        "type":"BPP"
    }'
    ```

  * Subscriber ID: Get using registry lookup API

  * Subscriber URI: Get using registry lookup API

  * Unique Key: Get using registry lookup API

  * Registry URL: `https://sandbox.onest.network/onest`

  * Webhook URL: The endpoint URL of your service the hosts protocol APIs like search, on\_search etc.

5. After making the changes in configuration files, run the below commands to create bap/bpp client and network docker containers:       &#x20;

* Execute `./deploy-bap.sh` file to deploy the BAP Client and Network.
* Execute `./deploy-bpp.sh` file to deploy the BPP Client and Network.

6. Test the protocol server by following the steps in [Testing](/learn/integration-of-adaptors/beckn-protocol-server/testing.md)section.

#### For PM2 Deployment

For PM2 deployment you need to git clone protocol-server four times to setup the BAP Client and Network and BPP Client and Network. Then copy `~/default-bap-client.yml` and `~/default-bap-network.yml` to config directory in respective git clone directory of BAP Client and Network. Also copy `~/default-bpp-client.yml` and `~/default-bpp-network.yml` to config directory in respective git clone directory of BPP Client and Network.

After configuration, Protocol Server can be run as below.

To run the instance in Development Mode (For Debug Purposes):

```
npm run dev
```

To run the instance in Production Mode:

```
npm i -g pm2
pm2 start ecosystem.config.js
```


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://starterpack.onest.network/learn/integration-of-adaptors/beckn-protocol-server/installation.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
