# Connect Local dev

> See when two programs listen on the same port, a local server stops answering, or a process takes more memory or CPU than it should. Everything is read on this Mac, and nothing is sent anywhere.

Source: https://coisland.app/docs/connect-localdev/

## What you need

- **You need:** No token, from Reads this Mac's ports and processes
- **The form asks:** Connector name
- **You can watch:** Port conflicts, Ports in use, Local server down, Heavy processes
- **Access:** Read this Mac's listening ports and processes, never stop or signal one

The Local dev connector reads the ports programs listen on and the processes running on your Mac. It sends nothing anywhere, keeps nothing in the Keychain, and never stops or signals a process. One covers the whole Mac.

## Add the Local dev connector

1. Open **Settings › Connectors**, click **+**, choose **Local dev**.
2. **Connector name:** what monitors call it, such as `local`.
3. Click **Add Connector**.

**Port conflicts** on every port (`port:any`) and **Heavy processes** above `memory:4GB` come as recommended monitors, added in one click.

## The four kinds

| Kind | Alerts when | Example body |
|---|---|---|
| Port conflicts (`localdev.conflicts`) | Two different programs listen on the same port | `port:any` |
| Ports in use (`localdev.ports`) | A program starts listening on a port | `program:node` |
| Local server down (`localdev.down`) | A port stops accepting connections, or an address stops answering 2xx | `port:3000` |
| Heavy processes (`localdev.heavy`) | One of your processes goes above a memory or CPU limit | `memory:4GB` |

### Port conflicts

Two different programs on one port: an SSH tunnel on `127.0.0.1:8080` shadowing a dev server on `*:8080`, or a Docker container and a local Postgres both on 5432. One program on both IPv4 and IPv6 is not a conflict, and neither are a server's own workers.

`port:any` watches every port. `port:3000`, `port:3000,5432` or `port:3000-3999` narrow it.

### Ports in use

A program starts listening on a port. The alert gives its name, pid, address and project folder. Narrow it with `port:`, or with `program:`, a program's name or a glob like `program:python*`.

### Local server down

`port:3000` alerts when nothing accepts connections on port 3000 any more. `url:http://localhost:3000/health` alerts when the address stops answering with a 2xx status, or doesn't answer at all. Each outage alerts once. Once the server is back, the next outage alerts again.

### Heavy processes

`memory:4GB` alerts when one of your processes uses more than 4 GB, the same number as the Memory column of Activity Monitor. `cpu:90%` alerts on CPU, measured over one second. Add `program:` to watch only some programs.

A process alerts once when it crosses the limit, and again only after it came back under. Only your own processes are read, not system daemons.

## A watch file

```text
-- name: Dev server down
-- kind: localdev.down
-- connector: local
-- every: 1m

port:3000
```

Local dev reads TCP ports and processes on this Mac. UDP ports and other machines aren't covered, and it never acts on a process.

## Troubleshooting

- **A system process shows no memory or CPU.** Only your own processes are readable, so Heavy processes leaves out the ones that run as another user, like system daemons.
- **Local server down alerts while the server is up.** With `url:`, anything but a 2xx answer counts as down, a 404 included. Point it at a path that answers 200, or watch the port with `port:`.

Next: the [Local dev connector](https://coisland.app/localdev/) for what it watches.
