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

# Module Examples

> Reference implementation and code samples for modules.

The Offline Container repository serves as the reference implementation for building and integrating modules.

<Card title="Offline Container Modules" icon="github" href="https://github.com/KindaBrazy/LynxHub-Module-Offline-Container">
  Explore the Offline Container codebase to see how modules are structured, registered, and executed.
</Card>

## Reference implementation

The [Offline Container](https://github.com/KindaBrazy/LynxHub-Module-Offline-Container) repository contains the integration code for local AI tools such as image generators, text generation LLMs, and audio synthesis tools.

### Core structure

* **Entry point**: The `src/main.ts` file acts as the main entry point. It registers all available modules with LynxHub.
* **Renderer script**: The `src/renderer.ts` file handles the frontend module scripts.
* **Module configuration**: The `package.json` file configures dependencies and build configurations using Rollup.

### Module registration

Each module registers an identifier and its lifecycle methods. The following code snippet shows how modules are registered in `src/main.ts`:

```typescript theme={null}
import {MainModules, MainModuleUtils} from '../../src/common/types/plugins/modules';
import Comfy_MM from './Container/Image/ComfyUI (comfyanonymous)/MainMethods';

export default async function initialModule(utils: MainModuleUtils): Promise<MainModules[]> {
  return [
    {
      id: 'comfyui',
      methods: () => Comfy_MM(utils),
    },
  ];
}
```

### Key utilities

The `utils` parameter provides helpers to interact with the host application:

* `utils.logger`: Logs messages to the central console.
* `utils.processManager`: Manages the lifecycle of child processes.
* `utils.settings`: Accesses user-defined module configurations.
