# What Is the Default Port for the OpenWork Local Server?

> Discover the default port for the OpenWork local server. Learn how to change it using the OPENWORK_SERVER_PORT environment variable. Access your OpenWork instance easily.

- Repository: [Different AI/openwork](https://github.com/different-ai/openwork)
- Tags: how-to-guide
- Published: 2026-08-21

---

**The OpenWork local server defaults to port 3000, which can be overridden via the `OPENWORK_SERVER_PORT` environment variable.**

The OpenWork project (from the `different-ai/openwork` repository) ships with a local development server powered by Vite. According to the source configuration in [`dev/apps/ui-demo/vite.config.ts`](https://github.com/different-ai/openwork/blob/main/dev/apps/ui-demo/vite.config.ts), the server binds to port 3000 out of the box while allowing runtime customization through environment variables.

## How the Default Port Is Configured

The port assignment is defined in the Vite configuration file for the UI demo application. In [`dev/apps/ui-demo/vite.config.ts`](https://github.com/different-ai/openwork/blob/main/dev/apps/ui-demo/vite.config.ts), the server configuration object explicitly sets the listening port using a fallback pattern:

```typescript
// dev/apps/ui-demo/vite.config.ts
export default defineConfig(({ mode }) => {
  const isProduction = mode === 'production'
  return {
    plugins: [react(), nodePolyfills({ include: ['crypto'] })],
    server: {
      // Using port 3000 as default as per the earlier comment. It can be overridden with OPENWORK_SERVER_PORT env variable.
      port: Number(process.env.OPENWORK_SERVER_PORT) || 3000,
      // host the server on all IP addresses for easier external access and debugging.
      host: true,
    },
    // ... additional build configuration
  }
})

```

The `port` property uses the logical OR operator to prioritize the `OPENWORK_SERVER_PORT` environment variable, falling back to `3000` when the variable is undefined.

## Overriding the Default Port

Developers can change the listening port without modifying source code by exporting the `OPENWORK_SERVER_PORT` variable before starting the development server.

### Start with the default port (3000):

```bash
cd dev/apps/ui-demo
pnpm dev

```

### Start with a custom port:

```bash
cd dev/apps/ui-demo
OPENWORK_SERVER_PORT=8080 pnpm dev

```

This pattern ensures that CI pipelines, Docker containers, or developers running multiple local services can avoid port conflicts without touching the Vite configuration.

## Network Binding and External Access

The configuration sets **`host: true`**, which instructs Vite to bind to all available IP addresses (0.0.0.0) rather than just localhost. This design choice facilitates:

- Debugging from mobile devices on the same network
- Testing inside containerized environments
- Access from remote development machines

When combined with the default port 3000, the server becomes reachable at `http://<local-ip>:3000` from any device on the network.

## Summary

- **Default port:** 3000 (defined in [`dev/apps/ui-demo/vite.config.ts`](https://github.com/different-ai/openwork/blob/main/dev/apps/ui-demo/vite.config.ts))
- **Override mechanism:** Set the `OPENWORK_SERVER_PORT` environment variable
- **Server framework:** Vite development server with React SWC plugin
- **Network binding:** `host: true` enables external access for debugging
- **Configuration file:** [`dev/apps/ui-demo/vite.config.ts`](https://github.com/different-ai/openwork/blob/main/dev/apps/ui-demo/vite.config.ts) contains the authoritative port logic

## Frequently Asked Questions

### What is the default port for the OpenWork local server?

The OpenWork local server listens on **port 3000** by default. This value is hard-coded as the fallback in the Vite configuration file located at [`dev/apps/ui-demo/vite.config.ts`](https://github.com/different-ai/openwork/blob/main/dev/apps/ui-demo/vite.config.ts).

### How do I change the OpenWork server port without editing code?

Export the `OPENWORK_SERVER_PORT` environment variable with your desired port number before launching the dev server. For example: `OPENWORK_SERVER_PORT=4000 pnpm dev`. The application will use this value instead of the default 3000.

### Why does OpenWork bind to all network interfaces?

The Vite configuration sets `host: true` to allow the server to accept connections from external devices and IP addresses. This supports debugging scenarios where you need to test the application from a mobile device or another machine on the same network.

### Where is the server port configuration stored?

The authoritative configuration resides in **[`dev/apps/ui-demo/vite.config.ts`](https://github.com/different-ai/openwork/blob/main/dev/apps/ui-demo/vite.config.ts)** within the `server` object. This TypeScript file is part of the UI demo package in the `different-ai/openwork` repository and controls both the port assignment and network binding behavior.