Files
api/api/docs/developer/workflows.md
Pujit Mehrotra bb9b539732 chore: fix local plugin builds & docs (#1851)
Raised by [MitchellThompkins](https://github.com/MitchellThompkins) in
#1848

- Documents how to use Docker to build a local Connect plugin
- Local Plugin flow will now build workspace packages before proceeding
with plugin infra + build
- Removes recommendation to run `pnpm build:watch` from root, as this
race conditions and build cache issues.
- Makes `pnpm dev` from root parallel, preventing servers from blocking
each other.

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

## Summary by CodeRabbit

* **Documentation**
* Updated development workflow documentation to emphasize Docker-based
plugin builds
* Restructured development modes into three workflows: local Docker
builds, direct deployment, and development servers
  * Updated build and deployment instructions

* **Chores**
  * Modified dev script for parallel execution
  * Refactored build scripts with improved dependency handling

<sub>✏️ Tip: You can customize this high-level summary in your review
settings.</sub>

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-12-18 16:33:37 -05:00

3.6 KiB

Unraid API Development Workflows

This document outlines the various workflow styles available for developing, building, and deploying the Unraid API monorepo.

Repository Structure

The Unraid API monorepo consists of several packages:

  • api: The Unraid API backend
  • web: The web frontend components
  • plugin: The Unraid plugin
  • unraid-ui: UI components library

Development Workflows

Local Development

To start all development servers in the monorepo:

pnpm dev

This command runs all development servers concurrently:

Package-Specific Development

If you want to work on a specific package, you can run its development server individually:

API Development

cd api
pnpm dev

Web Development

cd web
pnpm dev

UI Component Development

cd unraid-ui
pnpm dev

Building Workflows

Building All Packages

To build all packages in the monorepo:

pnpm build

Plugin Building (Docker Required)

The plugin build requires Docker. This command automatically builds all dependencies (API, web) before starting Docker:

cd plugin
pnpm run docker:build-and-run
# Then inside the container:
pnpm build

This serves the plugin at http://YOUR_IP:5858/ for installation on your Unraid server.

Package-Specific Building

API Building

cd api
pnpm build

Web Building

cd web
pnpm build

Development Build for Web

cd web
pnpm build:dev

Deployment Workflows

Deploying to Development Unraid Server

To deploy to a development Unraid server:

pnpm unraid:deploy <SERVER_IP>

This command builds and deploys all components to the specified Unraid server.

Package-Specific Deployment

API Deployment

cd api
pnpm unraid:deploy <SERVER_IP>

Web Deployment

cd web
pnpm unraid:deploy <SERVER_IP>

Plugin Deployment

cd plugin
pnpm unraid:deploy <SERVER_IP>

Testing

To run tests across all packages:

pnpm test

Package-Specific Testing

cd <package-directory>
pnpm test

Code Quality Workflows

Linting

To lint all packages:

pnpm lint

To automatically fix linting issues:

pnpm lint:fix

Type Checking

To run type checking across all packages:

pnpm type-check

GraphQL Codegen Workflows

For packages that use GraphQL, you can generate types from your schema:

cd <package-directory>
pnpm codegen

To watch for changes and regenerate types:

cd <package-directory>
pnpm codegen:watch

Docker Workflows

The API package supports Docker-based development:

cd api
pnpm container:build    # Build the Docker container
pnpm container:start    # Start the container
pnpm container:stop     # Stop the container
pnpm container:enter    # Enter the container shell
pnpm container:test     # Run tests in the container

CLI Commands

When working with a deployed Unraid API, you can use the CLI:

unraid-api --help
  1. Clone the repository: git clone git@github.com:unraid/api.git
  2. Set up the monorepo: just setup or pnpm install
  3. Start development servers: pnpm dev
  4. Make your changes
  5. Test your changes: pnpm test
  6. Deploy to a development server: pnpm unraid:deploy <SERVER_IP>
  7. Verify your changes on the Unraid server

If using nix, run nix develop from the root of the repo before Step 2.