---
id: device-connect-index
title: connect
sidebar_position: 2011
---
# connect

Connect device to local development server


## Description

Establishes a connection between a signageOS device and the local development environment,
allowing real-time testing and debugging of applets during development. Supports both
local network (LAN) and forward server connections for different network configurations.

The command sets up a development server and configures the device to load the applet
from the local machine, enabling hot reload and live debugging capabilities.

## Usage

```bash
sos device connect [options]
```

## Options

| Option                      | Description                                                                                                                                                            | Default |
| --------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------- |
| `--no-default-organization` | Prevent using the defaultOrganizationUid from ~/.sosrc (boolean)                                                                                                       |         |
| `--organization-uid`        | Organization UID (string)                                                                                                                                              |         |
| `--device-uid`              | Device UID (string)                                                                                                                                                    |         |
| `--applet-uid`              | Applet UID (string)                                                                                                                                                    |         |
| `--server-public-url`       | Public url of local machine server. Is useful when the local machine is behind a reverse proxy. (string)                                                               |         |
| `--server-port`             | The custom server port for local machine server. Default is detected from currently running applet server. (number)                                                    |         |
| `--force`                   | Force start applet server even if it is already running on a different port. Kill the running server first. (boolean)                                                  |         |
| `--use-forward-server`      | Use forward server to connect to the device instead of the local network (LAN). It's useful when the device is not in the same network as the local machine. (boolean) |         |
| `--detach`                  | Detach the applet HTTP server process from the terminal. Useful when want to run more commands reusing the same http server for current applet. (boolean)              | `false` |
| `--forward-server-url`      | Url of forward server to connect to the device instead of the local network (LAN). (string)                                                                            |         |
| `--hot-reload`              | Enable hot reload and build of applet (boolean)                                                                                                                        | `false` |
| `--applet-path`             | Path to the applet file or the project folder depending on the entry file. Relative to the command or absolute. (string)                                               |         |

## Examples

```bash
# Connect device with basic configuration
sos device connect --device-uid device123 --applet-uid my-applet

# Connect with custom server port
sos device connect --device-uid device123 --server-port 8080

# Connect using forward server (for remote devices)
sos device connect --device-uid device123 --use-forward-server

# Connect with hot reload enabled
sos device connect --device-uid device123 --hot-reload

# Connect with custom organization
sos device connect --device-uid device123 --organization-uid org456

# Connect with custom public URL
sos device connect --device-uid device123 --server-public-url https://my-domain.com

# Connect and run in background
sos device connect --device-uid device123 --detach

# Force connection (terminate existing servers)
sos device connect --device-uid device123 --force
```

## Advanced Usage

### Prerequisites

Before connecting a device:

1. **Build and upload applet**: The applet must be built and uploaded to the platform at least once
2. **Device configuration**: Ensure the device is properly configured and accessible
3. **Network access**: Device should be accessible via local network or use `--use-forward-server` for remote access

### Development Workflow

```bash
# Typical development workflow
sos applet generate --name my-applet
cd my-applet
npm run build
sos applet upload
sos device connect --device-uid device123 --hot-reload
```

### Network Considerations

- **Local Network (LAN)**: Default behavior, requires device and development machine on same network
- **Forward Server**: Use `--use-forward-server` when device is remote or behind different network
- **Custom Forward Server**: Override with `--forward-server-url` for private deployments
- **Public URL**: Set `--server-public-url` when behind reverse proxy or custom domain

## Configuration Tips

```bash
# Update package.json with applet UID when created
sos device connect --device-uid device123 --update-package-config

# Use custom ports for development
sos device connect --device-uid device123 --server-port 8080

# Run server in background for multiple sessions
sos device connect --device-uid device123 --detach
```


## Since

0.9.0

## Global Options

All commands support the following global options:

| Option | Alias | Description |
|--------|-------|-------------|
| `--help` | `-h` | Display help information for any command |
| `--version` | `-v` | Display the installed version of the CLI |
| `--api-url` | `-u` | Override the API URL for REST requests |
| `--profile` | | Use a specific profile from ~/.sosrc config |

### Examples

```bash
# Show version
sos --version

# Get help for any command
sos applet --help
sos applet upload --help

# Use custom API endpoint
sos --api-url https://api.example.com applet upload

# Use specific profile
sos --profile production organization list
```


## See Also

- [Device Connection and Development Documentation](https://developers.signageos.io/docs/applets/connect-to-device-cli/)