> ## Documentation Index
> Fetch the complete documentation index at: https://docs.lynxhub.app/llms.txt
> Use this file to discover all available pages before exploring further.

# Main backend overview

> Understand the environment and configuration of the LynxHub extension backend.

Extensions run code inside the Electron Main process. This allows you to utilize full Node.js APIs, interface with local operating system tools, listen to app lifecycle hooks, and control database storage.

***

## Environment details

The extension backend executes in a Node.js process managed by Electron. Since it runs in the main thread, it has unrestricted access to the local machine, filesystem, and native dependencies (such as spawning pseudo-terminals via `node-pty`).

***

## Entrypoint configuration

Your backend main script must build into `scripts/main/mainEntry.cjs` as a CommonJS module. The host application imports it during startup.

Your entrypoint file must export an `initialExtension` function:

```typescript theme={null}
import {ExtensionMainApi, MainExtensionUtils} from '@lynx_main/plugins/extensions/types';
import {MainIpcApi} from '@lynx_main/plugins/extensions/ipcWrapper';

module.exports = {
  initialExtension: async (lynxApi: ExtensionMainApi, utils: MainExtensionUtils, mainIpc: MainIpcApi): Promise<void> => {
    // Backend initialization logic here
  },
};
```

### Initialization parameters

The initialization function receives three arguments:

1. `lynxApi`: The central registry to subscribe to application startup triggers, window readiness, or inject tray menu items.
2. `utils`: Utility getters to resolve major application class singletons (like storage, modules, and window managers) or access native `node-pty` methods.
3. `mainIpc`: A structured wrapper namespace granting direct access to Core application IPC handlers.
