# Add Dependabot to a Medusa Monorepo

Yes. An agent writes a Dependabot config for your Medusa monorepo that groups npm updates, leaves Medusa's packages to your upgrade workflow, and opens a PR.

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

## What the agent does

The agent reads what already updates the repository before it adds a second updater. In a repository laid out like medusajs/dtc-starter, `.github/workflows/update.yaml` runs on `workflow_dispatch` and on a `repository_dispatch` of type `medusa-release-published`, and calls `medusa-update-action` with the released version to open a pull request that bumps every `@medusajs/*` package together; the Medusa packages in `apps/backend/package.json` are pinned exactly at 2.22.1 for that reason, and `@medusajs/ui` and `@medusajs/eslint-plugin` are pinned too. There is no `dependabot.yml` and no Renovate config. The root `package.json` sets `packageManager` to `pnpm@10.11.1` and a single `pnpm-lock.yaml` covers the workspace `apps/**` declared in `pnpm-workspace.yaml`, with `pnpm.overrides` holding `@types/react` and `@types/react-dom` at 19.0.5 and `tsconfig-paths` at `^4.2.0`.

Then it reads what else would move. The backend has `@tanstack/react-query`, `react-i18next`, `react-router-dom` and `zod` pinned exactly, and `@swc/core`, `jest`, `typescript`, `vite` and `yalc` with caret ranges in its dev dependencies; the storefront runs Next 16.3.8 and React 19.0.5 with `@medusajs/js-sdk` pinned at the same 2.22.1. The root dev dependencies are ESLint 9, `turbo` 2 and `prettier`. The one workflow uses `actions/checkout@v3` and `medusajs/medusa-update-action@v1` by major tag, so an actions ecosystem entry has two references to follow. The agent also notes the storefront is optional per `AGENTS.md`, so a config that names `apps/storefront` must not fail a backend-only fork.

It writes `.github/dependabot.yml` with three entries. An `npm` entry at `/`, which with pnpm's single lockfile covers the root and both apps, on a weekly schedule, with an `ignore` for `@medusajs/*` so Dependabot never races the upgrade workflow, a `groups` block that collects minor and patch updates into one pull request per week and leaves majors on their own, `open-pull-requests-limit` low enough that a quiet week is one pull request, and a `cooldown` of a few days so a release pulled from npm is not proposed the same morning. A second `npm` entry is not needed, and the pull request explains why in a sentence about the workspace lockfile. A `github-actions` entry at `/` on the same weekly schedule, grouped, with the same cooldown. Each `ignore` and `groups` pattern carries a comment naming the file it came from.

In its sandbox the agent validates the YAML against Dependabot's schema with a JSON schema validator, then dry-runs what the first week would propose: `pnpm outdated` at the root and per app, with the `@medusajs/*` lines removed, so the pull request can list which packages the first grouped update would touch and which majors would arrive separately. It runs `pnpm install --frozen-lockfile` and `pnpm lint` once so the description can say the tree is clean before Dependabot starts changing it.

## Start it with one API call

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

```json
{
  "agent": "claude",
  "input": "Add Dependabot to this Medusa monorepo. Read package.json, pnpm-workspace.yaml, pnpm-lock.yaml's header, apps/backend/package.json, apps/storefront/package.json, AGENTS.md and .github/workflows/update.yaml first. Write .github/dependabot.yml with an npm entry at the root that covers the pnpm workspace, ignores every @medusajs package because update.yaml already upgrades them together, groups minor and patch updates into one weekly pull request and leaves majors separate, sets a low open pull request limit and a cooldown of a few days; and a github-actions entry at the root, weekly and grouped. Put a comment on each ignore and group saying which file it comes from. Validate the file against Dependabot's configuration schema in your sandbox, run pnpm install --frozen-lockfile and pnpm lint, run pnpm outdated at the root and in each app, and open a pull request that lists what the first grouped update would include and which majors would come alone. Do not change update.yaml, any package.json or the lockfile.",
  "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 nothing else. Its description pastes the schema validation result, the `pnpm outdated` tables for the root and both apps with the Medusa lines struck out, and from them the list of packages the first grouped minor and patch pull request would carry and the majors that would open on their own.

The two `@v3` and `@v1` action references in `update.yaml` are named as what the `github-actions` entry will propose to bump, with a note that pinning them to a commit SHA is a separate change the reviewer can ask for.

Before merging, a reviewer decides whether the weekly day and cooldown suit their release rhythm, whether `react` and `next` majors should join the ignore list until the storefront is ready for them, and whether the open pull request limit should be lower still.

## Run it on every Monday morning

Once Dependabot opens its grouped pull request each week, the question becomes who proves it. An automation on the Project with a `github` trigger on `pull_request.opened` and the prompt "if the author is dependabot, install with pnpm, run pnpm lint and pnpm build, migrate a fresh Postgres with medusa db:migrate, boot the backend and check /health, then comment on the pull request with the result" starts one run per Dependabot pull request. The trigger adds the event after the prompt, and only work by an owner, member or collaborator fires it.

A team with several Medusa repositories sends this body once per repository from its own server, each a `POST /o/{org}/sessions` with that 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. Each run reads its own repository: one without an upgrade workflow gets no `@medusajs` ignore, and one on Yarn workspaces gets the same single root entry with that lockfile.

## Why run it on Rush?

A Dependabot file copied from another repository tends to list each app as its own directory, which a pnpm workspace does not need, and to let Dependabot bump `@medusajs/*` packages one at a time against an upgrade action that bumps them together, so two updaters fight over the same lines. The agent reads the lockfile layout and the existing workflow first and writes the ignore and the groups from what it found.

The validation, the `pnpm outdated` tables and the clean install stay with the run and are in the pull request, so the reviewer sees what the first week will propose before it does. The same request runs across every repository a team maintains at once.

## Frequently asked questions

### Why ignore the Medusa packages?

Because `update.yaml` already upgrades every `@medusajs/*` package together when a Medusa release is published, through `medusa-update-action`, and the backend pins them exactly so they move as a set. A Dependabot pull request that bumps one of them alone would conflict with that, so the npm entry ignores the scope and the description says where the upgrades still come from.

### Why one npm entry and not one per app?

The repository has a single `pnpm-lock.yaml` at the root for the workspace in `pnpm-workspace.yaml`. Dependabot reads that lockfile from the root entry and sees the dependencies of both apps, so a second entry would duplicate pull requests. A fork without `apps/storefront` works with the same file.

### Will the grouped pull request break the build?

It can, which is why the description names the automation that installs, lints, builds and migrates each Dependabot pull request and comments with the result. The config itself only decides what is proposed and how often; the group keeps the weekly noise to one pull request for minors and patches.

### Does it pin the actions to SHAs?

No. The `github-actions` entry follows the `@v3` and `@v1` tags the workflow uses today and proposes newer majors as they appear. Pinning to a commit is a change to `update.yaml`, which the prompt leaves alone; the description notes it as a follow-up.

## More Medusa jobs

- [Add a Dev Container to a Medusa Monorepo](https://getrush.ai/run/add-dev-containers/medusa/)
- [Add a Dockerfile to a Medusa Backend](https://getrush.ai/run/add-dockerfile/medusa/)
- [Add GitHub Actions CI to a Medusa Monorepo](https://getrush.ai/run/add-github-actions-ci/medusa/)

## The same job on other stacks

- [Add Dependabot to an Express and Mongoose API](https://getrush.ai/run/add-dependabot/mongoose/)
- [Add Dependabot to an Obsidian Plugin](https://getrush.ai/run/add-dependabot/obsidian-plugin/)
- [Add Dependabot to a Poetry Project](https://getrush.ai/run/add-dependabot/poetry/)

## 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/)
