# What Is the Default Port for ReClip? Configuration Guide for Flask Deployment

> Discover the default port for ReClip, which is 8899. Learn how to configure ReClip for Flask deployment and manage its port settings effectively.

- Repository: [Avery Gan/reclip](https://github.com/averygan/reclip)
- Tags: how-to-guide
- Published: 2026-09-03

---

**The default port for ReClip is 8899**, used by its Flask web server unless overridden by the `PORT` environment variable.

ReClip is an open-source web application built on Flask. Understanding its default port configuration is essential for containerized deployments, reverse proxy setups, and avoiding port conflicts in development environments. This guide explains how the port is defined in the source code and how to customize it for your infrastructure.

## Where the Default Port Is Defined

The port configuration resides in **[`app.py`](https://github.com/averygan/reclip/blob/main/app.py)** at line 208 of the ReClip repository. The implementation uses Python's `os.environ.get()` with a fallback value:

```python
port = int(os.environ.get("PORT", 8899))
app.run(host=host, port=port)

```

This pattern follows the **12-factor app methodology**, allowing environment-based configuration without code changes. The `PORT` variable is checked first; if absent or unset, the integer `8899` becomes the active port.

## How to Run ReClip with the Default Port

No configuration is required to use the default port. Start the application using either method:

```bash

# Using Docker Compose

docker-compose up

# Using the provided startup script

./reclip.sh

```

Both commands launch ReClip listening on **0.0.0.0:8899** inside the container.

## How to Override the ReClip Default Port

### Method 1: Export Before Running

```bash
export PORT=8080
docker-compose up

```

### Method 2: Inline Environment Variable

```bash
PORT=8080 ./reclip.sh

```

### Method 3: Docker Compose Port Mapping

The **[`docker-compose.yml`](https://github.com/averygan/reclip/blob/main/docker-compose.yml)** file controls host-to-container port mapping independently of the internal port:

```yaml
services:
  reclip:
    build: .
    ports:
      - "8899:8899"   # host:container (default)

```

To expose ReClip on a different host port while keeping the internal default:

```yaml
      - "8080:8899"   # external requests to :8080 → internal :8899

```

Or change both the environment variable and the mapping:

```yaml
    environment:
      - PORT=5000
    ports:
      - "80:5000"

```

## ReClip Port Configuration Files

| File | Location | Purpose |
|------|----------|---------|
| **[`app.py`](https://github.com/averygan/reclip/blob/main/app.py)** | `app.py:208` | Flask entry point; defines `8899` fallback |
| **[`reclip.sh`](https://github.com/averygan/reclip/blob/main/reclip.sh)** | [`reclip.sh`](https://github.com/averygan/reclip/blob/main/reclip.sh) | Shell startup script; propagates `PORT` if set |
| **[`docker-compose.yml`](https://github.com/averygan/reclip/blob/main/docker-compose.yml)** | [`docker-compose.yml`](https://github.com/averygan/reclip/blob/main/docker-compose.yml) | Orchestrates container port exposure |

## Summary

- **Default ReClip port is 8899**, hardcoded as fallback in [`app.py`](https://github.com/averygan/reclip/blob/main/app.py)
- Override via `PORT` environment variable for any deployment scenario
- Docker Compose port mapping (`host:container`) operates independently from the internal port setting
- All configuration is environment-driven with no source code modifications needed

## Frequently Asked Questions

### What happens if port 8899 is already in use on my system?

ReClip will fail to start with a `socket.error` or `Address already in use` exception. Run `PORT=9000 ./reclip.sh` (or any available port) to resolve the conflict.

### Can I use ReClip behind Nginx or another reverse proxy?

Yes. Keep `PORT=8899` internally and configure your reverse proxy to forward traffic to that port. The external port exposed via Docker Compose or Nginx can differ from the internal ReClip port.

### Does the [`reclip.sh`](https://github.com/averygan/reclip/blob/main/reclip.sh) script modify the default port behavior?

No. The script only exports `PORT` if already set in the environment; it does not override the `8899` default itself. The fallback logic remains exclusively in [`app.py`](https://github.com/averygan/reclip/blob/main/app.py).