> ## 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 module backend.

Module backends run code in the Electron Main process. This allows you to utilize Node.js API suites, interact with local operating systems, and manage subprocess terminals.

***

## Environment details

The extension backend runs inside a Node.js process managed directly by Electron. Because it runs in the main thread, it has unrestricted access to the local machine:

* Run filesystem operations (`fs-extra`).
* Intercept and manage host IPC channels.
* Spawn pseudo-terminals (`node-pty`) for CLI tools.

***

## Entrypoint configuration

Your backend script must build into `scripts/main.mjs` as an ES module. The host application imports it during startup.

Your entrypoint file must export a default async function that initializes your cards:

```typescript theme={null}
import {MainModules, MainModuleUtils} from '../../src/common/types/plugins/modules';

export default async function initialModule(utils: MainModuleUtils): Promise<MainModules[]> {
  return [
    {
      id: 'my-card-id',
      methods: () => ({
        // Backend card methods
      }),
    },
  ];
}
```

### Module registration array

The returned array contains `MainModules` objects mapping each module ID to its main process methods:

```typescript theme={null}
export type MainModules = {
  id: string;
  methods: () => CardMainMethods;
};
```
