# Add Dependabot to a Socket.IO App

Yes. An agent reads your Socket.IO app's two manifests, lockfiles, Dockerfiles and workflow, writes a grouped dependabot.yml, proves the suite green, and opens a PR.

[Run this on Rush](https://cloud.getrush.ai/run/add-dependabot/socket-io/). Opens the console with this prompt ready to send, in a Project that has your repository.

## What the agent does

The agent reads every manifest Dependabot would watch before it writes a line, because a configuration that misses a directory leaves that code un-updated without any warning. In a Socket.IO app laid out like socketio/socket.io-chat-platform there are two: `server/package.json`, with `socket.io`, `@socket.io/postgres-adapter`, `express`, `express-session`, `passport`, `passport-json`, `cors`, `body-parser`, `connect-pg-simple`, `pg`, `postgres-migrations`, `sql-bricks-postgres`, `argon2`, `ajv`, `ajv-formats` and `winston` on caret ranges and `mocha`, `chai`, `prettier` and `socket.io-client` as dev dependencies; and `vue-client/package.json`, with `vue`, `vue-router`, `pinia` and `socket.io-client`, plus `vite`, `@vitejs/plugin-vue` and `prettier`. Both `package-lock.json` files are `lockfileVersion` 3. There is no `.github/dependabot.yml`; `.github` holds only `workflows/ci.yml`.

That workflow is read next, because it decides whether a Dependabot pull request gets a check. `ci.yml` runs on push, pull request and a weekly cron, starts a `postgres:14` service, and runs `npm ci` and `npm test` in `./server` on Node 20 with `actions/checkout@v3` and `actions/setup-node@v3`, both version tags Dependabot can bump. Nothing builds `vue-client`, so a client update would merge on no evidence; the agent adds a `build-client` job that runs `npm ci` and `npm run build` in `./vue-client`. It also reads the images: `server/Dockerfile` is `FROM node:20-alpine`, `nginx/Dockerfile` builds the client on `node:20-alpine` and serves it from `nginx:1.25`, and `compose.yaml` runs `postgres:14`.

Then it writes `.github/dependabot.yml`. Two `npm` entries, one with `directory: /server` and one with `/vue-client`, both weekly. The server entry groups `socket.io`, `@socket.io/*` and `socket.io-client` as `socket-io`, `express`, `express-session`, `body-parser`, `cors`, `connect-pg-simple`, `passport` and `passport-json` as `express`, `pg`, `postgres-migrations` and `sql-bricks-postgres` as `postgres`, and `mocha` and `chai` as `test`; it ignores `version-update:semver-major` for `express`, since the app is on the 4 line and `server/src/index.js` mounts `body-parser` and `cors` the 4 way, so that upgrade is a code change and not a bot pull request. The client entry groups `vue`, `vue-router`, `pinia` and `@vitejs/plugin-vue` as `vue` and leaves `vite` on its own, so a major Vite bump arrives as one readable pull request. A `github-actions` entry on `/` covers the two actions, and `docker` entries on `/server` and `/nginx` cover the three base images. The file is checked against the `dependabot-2.0` JSON schema from SchemaStore before it is committed, because a misspelled key is ignored, not rejected.

Last, it proves the baseline the first Dependabot pull request will be compared with. In the sandbox it installs and starts Postgres, runs `npm ci` and `npm test` in `server` as `ci.yml` does, which executes the Mocha suites under `server/test` for auth, channels, messages and users over a real socket, and runs `npm ci` and `npm run build` in `vue-client`. `argon2` compiles a native addon during `npm ci`, so the agent notes that each server pull request will rebuild it on the runner. The output of all four commands goes into the pull request.

## Start it with one API call

`POST https://api.phoenix.so/o/{org}/sessions`

```json
{
  "agent": "claude",
  "input": "Add Dependabot to this Socket.IO app. Read server/package.json, server/package-lock.json, vue-client/package.json, vue-client/package-lock.json, .github/workflows/ci.yml, server/Dockerfile, nginx/Dockerfile, compose.yaml and server/compose.yaml first. Write .github/dependabot.yml with weekly npm entries for /server and /vue-client that group the Socket.IO packages, the Express packages, the Postgres packages, the test packages and the Vue packages, and ignore major updates of express. Add a github-actions entry and docker entries for each Dockerfile. Add a CI job that installs and builds vue-client so client updates get a check. Validate the file against the dependabot-2.0 JSON schema. Run npm ci and npm test in server with Postgres available, and npm ci and npm run build in vue-client, and open a pull request with the file, the workflow change, the schema check and the output. Do not upgrade any dependency yourself.",
  "resources": [
    {
      "url": "https://github.com/your-org/your-app"
    }
  ]
}
```

1. **Get an API key.** In the console, open Settings, then API keys, and create a key for your org. Send it in the Authorization header as a Bearer token.
2. **Send the request.** POST the body in request.json to https://api.phoenix.so/o/{org}/sessions, with your repository as the resources URL. The run starts in its own cloud sandbox.
3. **Read what came back.** Follow the run on its live stream or wait for the run.completed webhook, then read the result and its trajectory.

## What comes back

The pull request adds `.github/dependabot.yml` and adds one job to `.github/workflows/ci.yml`. Its description lists each group with the packages it matches, explains the `express` ignore rule with the lines in `server/src/index.js` that depend on the 4 API, and pastes the schema check, the Mocha output and the Vite build output.

`CI` runs on the pull request with its new `build-client` job. After the merge, Dependabot opens its first pull requests on the next weekly slot, one per group and directory, each with a lockfile diff and, for the server ones, a green or red `test-server` job behind it.

Before merging, a reviewer decides whether the weekly interval and the default limit of open pull requests suit the repository, whether `vite` should also be held back from majors until someone plans that upgrade, and whether the `postgres:14` image in `compose.yaml` should be tracked too; the agent names it in the description and leaves that choice open.

## Run it on every repository without Dependabot

A team with many Node services sends this body once per repository to `POST /o/{org}/sessions`, each with its own repository in `resources` and a `request_id` that is a UUID v5 of the repository's full name, so a retried call returns the run already started rather than opening a second pull request. Each run reads its own layout: a single-package app gets one `npm` entry on `/`, a workspace gets one per package directory, and a repository that already has `dependabot.yml` gets a comment on what the file lacks and no pull request.

Every run the key starts posts `run.completed` to the key's `webhook_url` with the pull request URL in `result`, so a script can collect them without polling; one that exceeds the key's `max_concurrent` is created anyway as `queued` and starts, oldest first, when a slot frees.

## Why run it on Rush?

A Dependabot file is short and its mistakes are quiet: a `directory` that points at the repository root of a two-package app updates nothing, a group pattern of `socket.io-*` misses `@socket.io/postgres-adapter`, and a major Express bump fails the suite for reasons unrelated to the dependency. The agent reads both manifests, both lockfiles, the workflow and the Dockerfiles before writing, and validates the result against the schema in its own sandbox.

The schema check, the Mocha run against a real Postgres and the client build all stay with the run, and the pull request quotes them, so a reviewer reads a file that was checked against a green baseline rather than one that looks right. Twenty repositories get the same treatment at once, each in its own sandbox with its own pull request.

## Frequently asked questions

### Why two npm entries instead of one at the root?

Dependabot reads the manifest in the directory an entry names and does not search subdirectories. The root of this repository has no `package.json`; the server and the client each have their own with their own lockfile, so each needs its own entry. Groups are per entry, which is also why the Vue group lives only on the client entry.

### Why hold express back from major updates?

The server is on the 4 line, and `server/src/index.js` uses `body-parser` and the `cors` middleware the 4 way, with `express-session` and Passport on top. The 5 line changed routing and dropped some request helpers, so that upgrade is a change someone plans and tests, not a weekly bot pull request. Minor and patch updates still flow.

### What about socket.io-client appearing in both packages?

Both entries match it: the server lists it as a dev dependency for the Mocha tests and the client as a runtime dependency. The `socket-io` group on the server entry and the explicit pattern on the client entry keep `socket.io`, its adapter and its client moving together, so the server and the client do not drift to different protocol versions.

### Does the run need Postgres?

Yes, for the baseline only. The Mocha suites under `server/test` connect to the `postgres` host and user that `ci.yml` configures and run `postgres-migrations` against `server/sql` on start, so the agent installs and starts a Postgres in the sandbox before `npm test`. Writing `dependabot.yml` itself needs no database.

### Will Dependabot update the base images in compose.yaml?

Only if the file gets its own entry. The `docker` entries cover `server/Dockerfile` and `nginx/Dockerfile`; `compose.yaml` and `server/compose.yaml` pin `postgres:14`, and the pull request says so and leaves adding a `docker-compose` entry to the reviewer.

## More Socket.IO jobs

- [Add a Dockerfile to a Socket.IO Chat Server](https://getrush.ai/run/add-dockerfile/socket-io/)
- [Add Graceful Shutdown to a Socket.IO Server](https://getrush.ai/run/add-graceful-shutdown/socket-io/)
- [Add a Health Check Endpoint to a Socket.IO Server](https://getrush.ai/run/add-health-checks/socket-io/)

## The same job on other stacks

- [Add Dependabot to a SolidJS App](https://getrush.ai/run/add-dependabot/solidjs/)
- [Set Up Dependabot for a Streamlit App](https://getrush.ai/run/add-dependabot/streamlit/)
- [Add Dependabot to a Textual App](https://getrush.ai/run/add-dependabot/textual/)

## Keep reading

- [How a Rush run works on your repository, from request to pull request](https://getrush.ai/cloud/)
- [Compare cloud agents, agent sandboxes and AI code review](https://getrush.ai/compare/)
- [Rush pricing: Free, Pro and Max](https://getrush.ai/pricing/)
