---
title: "See what is inside your bundles"
description: "Measure the backend's Convex bundle and the Nuxt app's bundles with one command, see how much of each the package brings, act on its insights, and hold both to a budget in CI."
canonical_url: "https://nuxt-backend.dev/docs/develop/analyze"
---
# See what is inside your bundles

> Measure the backend's Convex bundle and the Nuxt app's bundles with one command, see how much of each the package brings, act on its insights, and hold both to a budget in CI.

Version: nuxt-backend 0.6.x · Tab: Develop · Kind: how-to · Status: stable

Every page: [llms.txt](https://nuxt-backend.dev/llms.txt) · Skill for coding agents: [nuxt-backend](https://nuxt-backend.dev/.well-known/skills/nuxt-backend/SKILL.md)

Commands use npm; use your project's package manager.

`npx nuxt-backend analyze` measures both halves of the app in one run: the bundle Convex pushes for your `backend/` functions, and the bundles Nuxt builds for the browser and the server. It names the largest packages, flags duplicates, and shows how much of each bundle comes from `nuxt-backend` and from your own code.

The Convex half runs Convex's own analyzer, [`@convex-dev/bundle-analyzer`](https://www.npmjs.com/package/@convex-dev/bundle-analyzer), an optional peer of `nuxt-backend`, so only apps that run `analyze` install it. Install it once, at the version `nuxt-backend` pins:

```bash
npm install -D @convex-dev/bundle-analyzer@0.1.0
```

Without it, `analyze` lists the Convex half as not measured, names that command, and still measures the Nuxt half. The analyzer is in alpha, so its numbers and insights may change between its releases, and it bundles with its own copy of the `convex` bundler: when that differs from your `convex`, the report says so. The Nuxt half reads the build that `nuxi analyze` makes.

<steps level="3">

### Measure the whole app

```bash
npx nuxt-backend analyze
```

The report has one section per bundle: the backend's Convex bundle with its components, and the Nuxt client and server bundles. Each section gives the total size, the share that `nuxt-backend` and your own code take, and the largest packages. The insights come last: a package bundled twice, a package that every component bundles again, a `"use node"` file that pulls a whole SDK.

What each size counts:

<table>
<thead>
  <tr>
    <th>
      Bundle
    </th>
    
    <th>
      Size
    </th>
    
    <th>
      <code>
        nuxt-backend
      </code>
      
      's share
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      Convex
    </td>
    
    <td>
      The code of the bundle <code>
        convex deploy
      </code>
      
       would push, without source maps: your functions and each component, added up (each component is bundled on its own)
    </td>
    
    <td>
      The package's component, with the dependencies it brings, and its own files in your functions' bundle
    </td>
  </tr>
  
  <tr>
    <td>
      Client
    </td>
    
    <td>
      Every JavaScript chunk of the browser build, minified, with the gzipped size beside it
    </td>
    
    <td>
      The package's runtime files, and the templates its module writes
    </td>
  </tr>
  
  <tr>
    <td>
      Server
    </td>
    
    <td>
      Nitro's bundle, before minification: Nitro doesn't minify unless you ask it to
    </td>
    
    <td>
      The same, on the server
    </td>
  </tr>
</tbody>
</table>

The rest is "your code" (the files under your `backend/`, or your app) and everything else: your other dependencies, Nuxt itself, and generated code. The Nuxt build is a production build, so it takes as long as `nuxt build` and rewrites `.nuxt/` as it does; its output goes to a temporary folder, and your `.output` stays as it was.

It needs `backend/_generated/`, which `npx nuxt-backend dev` keeps current, and installed dependencies. It writes nothing to your deployment. A half that can't run is reported under **Not measured**, and the other half is still measured. The client bundle needs [`rollup-plugin-visualizer`](https://www.npmjs.com/package/rollup-plugin-visualizer), which `nuxi analyze` asks for; most installs already have it through Nitro, and when yours doesn't, add it as a dev dependency.

Each run is kept in `node_modules/.cache/nuxt-backend/analyze.json`, for the Bundles panel and for the doctor.

### Look at one half

```bash
npx nuxt-backend analyze --only convex
npx nuxt-backend analyze --only nuxt
```

`--only convex` skips the Nuxt build, so it answers in seconds. To drill into the Convex bundle, run the analyzer's own commands from the app's root: `packages zod` shows which of your modules import a package, `modules backend/billing.ts` shows what one module loads, and `explore` opens a treemap in the terminal.

```bash
npx @convex-dev/bundle-analyzer packages zod
```

A package that every component bundles again (`zod`, `convex-helpers`) is reported as information, not a warning: Convex bundles each component on its own, so it can't be shared.

### Act on an insight

Each insight names the bytes it would save and where the import comes from. The common fixes:

- **A package bundled twice:** two copies are installed, usually at two versions. Dedupe them (`pnpm dedupe`), or align the version your code asks for with the one a dependency uses. The Nuxt half reports a duplicate once its copies add up to a kilobyte or more.
- **A large package in one module:** move that work into an action in a `"use node"` file, or import a smaller entry of the package.
- **The package's own share looks large:** report it. Every capability you don't use should cost close to nothing, and a regression there is a bug in `nuxt-backend`.

### Hold a budget in CI

```bash
npx nuxt-backend analyze --max-convex 8MB --max-client 350kB --json
```

With a `--max-*` flag, `analyze` exits `1` when a bundle grows past its budget and names what grew: the packages that grew most since the run before, which a CI job has when it restores `node_modules/.cache`, or else the bundle's largest package. `--json` prints the report for a script or an agent. The sizes are code without source maps, so a budget doesn't move when source maps change. A size is a number with a unit: `8MB`, `350kB`, `2MiB`, or bytes alone. A budget for a bundle the run doesn't measure (`--max-client` with `--only convex`) is refused. When the build writes no stats for a bundle that has a budget, the run fails too, so the gate never passes unchecked.

</steps>

## In DevTools

The Backend tab in [DevTools](https://nuxt-backend.dev/docs/develop/devtools) has a **Bundles** panel with the same report and a refresh key. Opening it shows the last run; the key runs `analyze --only convex`, and nothing else does, because a run bundles the backend again.

## What the doctor says

`doctor` reports one finding from the last run, when there is one: [`bundle-duplicates`](https://nuxt-backend.dev/docs/reference/cli/diagnostics#bundle-duplicates) warns when a package is bundled more than once in the Convex bundle, and names the fix. It never runs the analyzer itself, and it says nothing once a lockfile is newer than the run, since the install it measured has changed.

## Related

- [`analyze` in the CLI reference](https://nuxt-backend.dev/docs/reference/cli#analyze): every flag, its JSON and its exit codes.
- [Diagnose your setup with doctor](https://nuxt-backend.dev/docs/develop/doctor): the checks that run against the deployment.
- [Develop locally](https://nuxt-backend.dev/docs/develop/dev-loop): the loop that keeps `backend/_generated/` current.


## Sitemap

See the full [sitemap](https://nuxt-backend.dev/sitemap.md) for all pages.
