Files
api/packages/unraid-api-plugin-connect/src
Pujit Mehrotra 7be8bc84d3 fix(connect): mothership connection (#1464)
---
- To see the specific tasks where the Asana app for GitHub is being
used, see below:
  - https://app.asana.com/0/0/1210709463978079

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **New Features**
* Improved management of cloud connection status and error handling for
DNS resolution issues.
* Introduced a centralized controller for managing mothership connection
lifecycle and subscriptions.

* **Refactor**
* Streamlined event handling and resource management for mothership
connections.
* Consolidated connection logic to enhance reliability and
maintainability.
* Optimized initialization process by deferring GraphQL client creation
until needed.

* **Chores**
* Updated module configuration to include the new controller for better
dependency management.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-07-07 17:14:47 -04:00
..

@unraid-api-plugin-connect/src

This directory contains the core source code for the Unraid Connect API plugin, built as a modular NestJS application. It provides remote access, cloud integration, and configuration management for Unraid servers.

Structure

  • index.ts: Main entry, conforming to the nestjs API plugin schema.
  • authn/: Authentication services.
  • config/: Configuration management, persistence, and settings.
  • connection-status/: Connection state monitoring and status tracking.
  • graphql/: GraphQL request definitions and generated client code.
  • helper/: Utility functions and constants.
  • internal-rpc/: Internal RPC communication services.
  • mothership-proxy/: Mothership server proxy and communication.
  • network/: Network services including UPnP, DNS, URL resolution, and WAN access.
  • remote-access/: Remote access services (static, dynamic, UPnP).
  • unraid-connect/: Core Unraid Connect functionality and settings.
  • __test__/: Vitest-based unit and integration tests.

Each feature directory follows a consistent pattern:

  • *.module.ts: NestJS module definition
  • *.service.ts: Business logic implementation
  • *.resolver.ts: GraphQL resolvers
  • *.model.ts: TypeScript and GraphQL models, DTOs, and types
  • *.events.ts: Event handlers for event-driven operations
  • *.config.ts: Configuration definitions

Usage

This package is intended to be used as a NestJS plugin/module. Import ApiModule from index.ts and add it to your NestJS app's module imports.

import { ApiModule } from '@unraid-api-plugin-connect/src';

@Module({
  imports: [ApiModule],
})
export class AppModule {}

Development

  • Install dependencies from the monorepo root: pnpm install
  • Build: pnpm run build (from the package root)
  • Codegen (GraphQL): pnpm run codegen
  • Tests: vitest (see __test__/ for examples)
  • Format: pnpm run format to format all files in project

Notes

  • Designed for Unraid server environments.
  • Relies on other Unraid workspace packages (e.g., @unraid/shared).
  • For plugin installation and system integration, see the main project documentation.