> For the complete documentation index, see [llms.txt](https://lern.sunbird.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://lern.sunbird.org/use/developer-guide/discussion-forum/developer-installation/installation-guide/discussion-middleware-setup.md).

# Discussion Middleware Setup

Discussion middleware is middleware proxy service, which is having all discussion forum apis.

### How to setup discussion middleware.

**Step:1**

Clone the discussion middleware repo from <https://github.com/Sunbird-Ed/discussions-middleware.git>

**Step:2**

Execute `npm install` command.

**Step:3**

add the environment variable in environmentHelper.js file.

```
let localEnvVariables = {
    NODEBB_SERVICE_URL: env.nodebb_service_url || 'http://localhost:4567', 
    Authorization:  env.authorization_token || 'd8402b15-1d5f-4d84-9fae-595ef805f287', // Your local nodebb Master token
    nodebb_api_slug: env.nodebb_api_slug || '/api'
}
```

**Note**: If your testing the DF-lib using demo application. You have to use user token instead of master token. Once we implemented DF-middleware cache then onwards no need to change the token. we can use master token itself.

**Step:4**

Run the discussion middleware using the command `npm run start`. Discussion-middleware will run on port **3002.**


---

# 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, and the optional `goal` query parameter:

```
GET https://lern.sunbird.org/use/developer-guide/discussion-forum/developer-installation/installation-guide/discussion-middleware-setup.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
