> ## Documentation Index
> Fetch the complete documentation index at: https://orphelix.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# orphelix rebuild

> Rebuild and restart Orphelix application

# orphelix rebuild

Rebuild the Next.js application and restart PM2 process. This is useful after making code changes.

## What it does

The `rebuild` command performs four steps:

1. **Update Dependencies** - Checks for and updates outdated dev dependencies
2. **Build** - Runs `npm run build` to create production build
3. **Sync Assets** - Copies static assets to standalone build
4. **Restart** - Restarts the PM2 process with new code

## Usage

```bash theme={null}
orphelix rebuild [options]
```

## Options

| Option | Alias | Description |
| - | - | - |
| `--port` | `-p` | Custom port |
| `--name` | `-n` | Instance name |

## Example

```bash theme={null}
# Rebuild default instance
orphelix rebuild

# Rebuild specific instance
orphelix rebuild --name prod

# Rebuild with custom port
orphelix rebuild --port 8080
```

## When to use

Use `rebuild` when:

* You've made code changes and want to deploy them
* You've pulled latest changes from git
* You've updated dependencies
* You need a fresh build

## Difference from restart

| Command | What it does |
| - | - |
| `restart` | Only restarts PM2 process (fast, \~1s) |
| `rebuild` | Builds + restarts (slower, \~30-60s) |

Use `restart` for configuration changes, use `rebuild` for code changes.

## Related Commands

* [start](https://orphelix.mintlify.site/cli/commands/start.md) - Start Orphelix
* [restart](https://orphelix.mintlify.site/cli/commands/restart.md) - Quick restart without rebuild
* [stop](https://orphelix.mintlify.site/cli/commands/stop.md) - Stop Orphelix


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.