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

# Port Already in Use

> Resolving port conflicts

This covers port conflict issues and how to resolve them.

## Development Server Port Conflict

### Symptoms

```bash theme={null}
pnpm dev

Error: listen EADDRINUSE: address already in use :::10280
```

### Cause

Another process is already running on the specified port.

### Solutions

#### 1. Find and Kill Process

**macOS/Linux:**

```bash theme={null}
# Find process using the port
lsof -i :10280

# Kill process
kill -9 <PID>
```

**Windows:**

```bash theme={null}
# Find process using the port
netstat -ano | findstr :10280

# Kill process
taskkill /PID <ProcessID> /F
```

#### 2. Manually Specify Port

`sonamu.config.ts`:

```typescript theme={null}
export default {
  server: {
    listen: {
      port: 10281, // Use different port
      host: "localhost",
    },
  },
} satisfies SonamuConfig;
```

## Sonamu UI Access

### Description

Sonamu UI uses the same port as the API server and is accessed via the `/sonamu-ui` path.

```bash theme={null}
# Changing API server port
```

```typescript theme={null}
export default {
  server: {
    listen: {
      port: 10280,
    },
  },
} satisfies SonamuConfig;
```

Sonamu UI access: `http://localhost:10280/sonamu-ui`

## Running Multiple Projects Simultaneously

### Symptoms

Ports conflict when trying to run multiple Sonamu projects simultaneously.

### Solution

Use different ports for each project:

**Project A:**

```typescript theme={null}
// sonamu.config.ts
export default {
  server: {
    listen: {
      port: 10280,
    },
  },
} satisfies SonamuConfig;
```

**Project B:**

```typescript theme={null}
// sonamu.config.ts
export default {
  server: {
    listen: {
      port: 10380,
    },
  },
} satisfies SonamuConfig;
```

## PostgreSQL Port Conflict

### Symptoms

```bash theme={null}
Error: could not connect to server: Connection refused
  Is the server running on host "localhost" (::1) and accepting
  TCP/IP connections on port 5432?
```

### Cause

PostgreSQL is not running, or another process is using port 5432.

### Solutions

#### 1. Check PostgreSQL Running

```bash theme={null}
# macOS
brew services list
brew services start postgresql

# Linux
sudo systemctl status postgresql
sudo systemctl start postgresql
```

#### 2. Run PostgreSQL on Different Port

In PostgreSQL config file (`postgresql.conf`):

```conf theme={null}
port = 5433  # Use different port
```

After restart, update `.env` file:

```bash theme={null}
DB_PORT=5433
```

#### 3. Check Port Conflict Process

```bash theme={null}
lsof -i :5432
```

## Related Documentation

* [Server Configuration](/en/configuration/sonamu-config/server)
* [Development Environment Setup](/en/getting-started/development-setup)
