How to Build OpenWork from Source: Complete Build Instructions
To build OpenWork, clone the repository, install dependencies with pnpm install, and run pnpm build from the root to compile the monorepo using the orchestration script at scripts/build.mjs.
OpenWork is a pnpm-workspace monorepo that bundles a desktop Electron client, web UI, and server-side components. Understanding the exact build instructions for OpenWork requires navigating the root package.json scripts and the Node.js orchestration logic that drives the compilation process.
Prerequisites
Before compiling, ensure your environment meets the toolchain requirements defined in the repository.
- Node.js and pnpm: The project uses
pnpm@11for workspace management. Install it globally:
npm install -g pnpm
- Source Code: Clone the
different-ai/openworkrepository and checkout the active development branch:
git clone https://github.com/different-ai/openwork.git
cd openwork
git checkout dev
Install Workspace Dependencies
OpenWork uses pnpm workspaces to link internal packages. Run the install command from the repository root to symlink all interdependencies across packages/*:
pnpm install
This creates the workspace graph required for the build scripts to resolve internal modules like @openwork/app and @openwork/desktop.
Run the Production Build
The primary build instructions for OpenWork are encapsulated in the root [package.json](https://github.com/different-ai/openwork/blob/dev/package.json) script entry "build": "node scripts/build.mjs".
Execute the full monorepo build:
pnpm build
What the Build Script Does
The scripts/build.mjs file orchestrates the compilation pipeline:
- TypeScript Compilation: Runs
tscto type-check the core packages. - UI Bundling: Invokes Vite to bundle the web assets.
- Asset Copying: Moves static files to the distribution directories.
This single entry point ensures consistent build artifacts across desktop and web targets.
Build Specific Packages
For targeted compilation, use pnpm's --filter flag to build individual workspace members without triggering the entire monorepo pipeline.
Desktop Client Only
pnpm --filter @openwork/desktop build
Web UI Only
The shortcut script build:ui aliases the filter command for the main application package:
pnpm build:ui
This executes pnpm --filter @openwork/app build as defined in the root package.json.
Enterprise Components
Build specific enterprise edition packages:
pnpm --filter @openwork-ee/den-web build
Development Builds
For active development with hot-reloading, use the dev script instead of the production build.
pnpm dev
This command sets OPENWORK_DEV_MODE=1 and launches the desktop client with automatic port selection for the Chrome DevTools Protocol (CDP). Internally, it resolves to:
OPENWORK_DEV_MODE=1 pnpm --filter @openwork/desktop dev
You can customize the development profile using environment variables:
OPENWORK_DEV_PROFILE=my-feature OPENWORK_ELECTRON_REMOTE_DEBUG_PORT=0 PORT=0 pnpm dev
Verification and Preview
After a successful build, verify the output by serving the built UI:
pnpm preview
This starts a preview server using the production bundle, allowing you to validate the build before deployment.
Summary
- Install: Use
pnpm installto initialize the workspace dependencies. - Build: Run
pnpm buildto execute the orchestration script atscripts/build.mjs, which handles TypeScript compilation and Vite bundling. - Filter: Use
pnpm --filter <package-name> buildfor targeted package builds, orpnpm build:uifor the web application only. - Develop: Launch
pnpm devfor hot-reloading development withOPENWORK_DEV_MODEenabled. - Verify: Execute
pnpm previewto test the production build locally.
Frequently Asked Questions
What package manager does OpenWork require?
OpenWork requires pnpm. The build scripts and workspace configuration rely on pnpm-specific features like workspace filtering and hoisting. Using npm or yarn will fail to resolve internal workspace dependencies.
How do I build only the desktop application?
Run pnpm --filter @openwork/desktop build. This command targets only the desktop package within the monorepo, skipping the web UI and server components for faster iteration during desktop-specific development.
Can I run OpenWork in development mode without building first?
Yes. Execute pnpm dev from the root. This command sets OPENWORK_DEV_MODE=1 and launches the Electron client with hot-reloading enabled, bypassing the production build step while providing immediate feedback on code changes.
Where is the build logic defined?
The main build logic resides in scripts/build.mjs. This Node.js script coordinates TypeScript compilation, Vite bundling, and asset management across the monorepo, invoked automatically when you run pnpm build.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →