> For the complete documentation index, see [llms.txt](https://ed.sunbird.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ed.sunbird.org/use/source-code/desktop/component-diagram.md).

# Component Diagram

#### Video on Desktop App

{% embed url="<https://youtu.be/H8afe1-cF_c?si=MvSjRbyVzu0vq4Y5>" %}

## GitHub Repository

{% embed url="<https://github.com/Sunbird-Ed/SunbirdEd-portal/tree/master/src/desktop>" %}
github repo
{% endembed %}

## Architecture

<figure><img src="/files/dMSzkEG86bVYZv7StxaT" alt=""><figcaption><p>Desktop Architecture</p></figcaption></figure>

Sunbird desktop runs on a platform called [electron](https://www.electronjs.org/).

## Sunbird Desktop

<img src="/files/h3qtY70E3xNv6x06hB6T" alt="" width="375">

### Sunbird Desktop UI

<img src="/files/qIfQdXzs6WMWxGd3YQOK" alt="" width="375">

The Portal folder is responsible for rendering the UI on the desktop.

### Sunbird Desktop API Server

<img src="/files/aUPvNIrGqx6wdGtkKfW0" alt="" width="375">

The Modules folder contains the API server proxy to communicate with the upstream server.

### Code Structure

Important folders

These are the important folders that are used in Sunbird Desktop:

* [helpers](https://github.com/Sunbird-Ed/SunbirdEd-portal/tree/master/src/desktop/helper)
* [gulpfile.js](https://github.com/Sunbird-Ed/SunbirdEd-portal/blob/master/src/desktop/gulpfile.js)
* [main.ts](https://github.com/Sunbird-Ed/SunbirdEd-portal/blob/master/src/desktop/main.ts)
* [modules](https://github.com/Sunbird-Ed/SunbirdEd-portal/tree/master/src/desktop/modules)
* [OpenRAP](https://github.com/Sunbird-Ed/SunbirdEd-portal/tree/master/src/desktop/OpenRAP)
* [Public](https://github.com/Sunbird-Ed/SunbirdEd-portal/tree/master/src/desktop/public)
* [env.json](https://github.com/Sunbird-Ed/SunbirdEd-portal/blob/release-6.0.0/src/desktop/env.json)
* [openrap-sunbirded-plugin](#openrap-sunbirded-plugin)

### [helpers](https://github.com/Sunbird-Ed/SunbirdEd-portal/tree/master/src/desktop/helper)

This folder is used to provide the Authentication/Authorization session of the logged-in user.

### [gulpfile.js](https://github.com/Sunbird-Ed/SunbirdEd-portal/blob/master/src/desktop/gulpfile.js)

In the portal desktop Gulp is a task runner that uses Node.js as a platform. Gulp purely uses JavaScript code and helps to run front-end tasks and large-scale web applications. It builds system automated tasks like CSS and HTML minification, concatenating library files, and compiling the SASS files.

### [main.ts](https://github.com/Sunbird-Ed/SunbirdEd-portal/blob/master/src/desktop/main.ts)

The main.ts file is the entry point of a portal desktop where all the script executions are initiated.

### [modules](https://github.com/Sunbird-Ed/SunbirdEd-portal/tree/master/src/desktop/modules)

This folder contains API server proxy to communicate with the upstream server, such as routes, sdk db schema, logger, proxy-util, and telemetry helper.

### [OpenRAP](https://github.com/Sunbird-Ed/SunbirdEd-portal/tree/master/src/desktop/OpenRAP)

OpenRAP is more like a repo, where we have a content database, which is meant for desktop. It's a standalone app that runs mainly offline first. In offline, first, certain items such as content items and telemetry user data have to be stored & when the user log-in it's not online, but it will give the data from the [pouchdb](#pouchdb).

OpenRAP is an open-source initiative to enable communities/stakeholders to easily build and deploy WiFi-enabled resource access points within their community.

### [pouchdb](https://pouchdb.com/)

It enables applications to store data locally while offline, then synchronize it with PouchDB and compatible servers when the application is back online, keeping the user's data in sync no matter where they next log in.

### [Public](https://github.com/Sunbird-Ed/SunbirdEd-portal/tree/master/src/desktop/public)

The folder includes the code to initiate the player and the portal UI in the desktop app.

### [env.json](https://github.com/Sunbird-Ed/SunbirdEd-portal/blob/release-6.0.0/src/desktop/env.json)

It contains the [env.json](https://github.com/Sunbird-Ed/SunbirdEd-portal/blob/release-6.0.0/src/desktop/env.json) file, which is responsible for storing the env variable such as token, baseurl, and id that is required in the Desktop from DevOps.

### openrap-sunbirded-plugin

It contains the below folders:

**content**: sample content to be used for offline desktop

**Data**: It contains some sample channels used as a default, sample form JSON, faq, framework & location.

**ecars**: It stands for ekstep content archive. It stores and loads the ecars if required on desktop.

### Resources:

* [Portal Desktop Application - Local Setup](https://project-sunbird.atlassian.net/wiki/spaces/SP/pages/3339354113/Portal+Desktop+Application+-+Local+Setup)
* [OpenRAP](https://sunbird.org/explore/articles/16-sunbird-openrap-an-offline-content-distribution-platform)
* [electron](https://www.electronjs.org/)

#### &#x20;<a href="#title-text" id="title-text"></a>


---

# 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://ed.sunbird.org/use/source-code/desktop/component-diagram.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.
