---
title: Configuration
description: One file, dex.config.ts, for everything the studio needs to know.
---

Everything is in `dex.config.ts` at your project's root, like Storybook's `main.ts`. Every setting has a default; most projects set `content` and `designSystem`. The file is checked when the studio loads it, and a mistake is reported with its path. It can be `.ts`, `.mts`, `.js` or `.mjs`. A studio made before Dex has `studio.config.ts`, which still works; `npx dex upgrade` renames it.

```ts
import { defineConfig } from "@dexhq/canvas/config";

export default defineConfig({
  content: "./studio",
  ui: {
    title: "Acme Studio",
    subtitle: "Acme Design System",
    components: "./studio/ui.tsx",
  },
});
```

| Setting | Default | What it does |
| --- | --- | --- |
| `build.comments` | `true` | Whether `dex build` and `dex cloud publish` put every file's comments in the site, as they are when it builds, to read: pins, threads and the bell, with no reply or resolve. Resolved threads go too; deleted ones never do. A linked studio's come from its workspace when you're signed in or `STUDIO_CLOUD_TOKEN` is set, or from its comments files, with a warning, when the workspace can't be reached; any other studio's come from its comments files. `false` leaves them out: set it for a public deploy. Set in **Settings → Deployment**. |
| `build.pictures` | `true` | Whether `dex build` and `dex cloud publish` make a picture of every view on the canvases, in light and dark, so the built canvas shows each frame when zoomed out and while its page loads, as a running studio does. They're made with Playwright's Chromium (`npx playwright install chromium`); where it isn't installed, the build says so and goes on, and zoomed-out frames show their names. `false` builds faster, without them. |
| `build.review` | `true` | Whether people on the site `dex build` makes (and `dex cloud publish` shares) can mark up its canvases: each reviewer's comments stay in their browser until they send them back as a file you import. `false` leaves the site to look at only. Set in **Settings → Deployment**, where **Preview deployed site** shows the site in the running Dex. |
| `content` | `"."` | The folder with files (`files/`), `DESIGN.md`, `people/` and contributors. |
| `designSystem` | what `components.json` says | The design system files build with: its components (a folder, scanned on every start, or a package's name), imports, styles, guide and contributing doc. What it leaves out is read from your project's files on every start. See [Design systems](/docs/design-systems). |
| `designSystem.provider` | none | A module whose default export wraps every view: on the canvas, in Play, opened on its own and in a built studio. For theme providers and global setup your components need (below). |
| `git.base` | the remote's default branch | The branch pull requests merge into, and new branches start from. Set in **Settings → Workspace settings**. See [Branches and pull requests](/docs/branches-and-pull-requests). |
| `git.prefix` | `"dex/"` | What new branches made on the canvas start with. |
| `outDir` | `node_modules/.cache/dex/dist` | Where `dex build` writes the static site. By default in node_modules, which git and your project's lint, formatter and typecheck skip; a config that names one keeps it. |
| `port` | `3008` | Port for `dex dev` and `dex preview`. `STUDIO_PORT` overrides it, and `dev` then keeps to it. Taken by anything else, `dev` moves on to the next free port. Give each project its own: an installed Dex app opens the port it was installed from. |
| `plugins` | none | Extra Vite plugins: `next()` in a Next app (below), and styling that compiles at build time (StyleX, vanilla-extract). |
| `vite` | none | A last change to the Vite config: `(config) => ({ ...config })`. |
| `ui.title` | "Dex" | The workspace's name: at the top of the sidebar and in the browser tab. Set in **Settings → Workspace settings**. |
| `ui.workspaceIcon` | none | The workspace's icon beside its name: `"workspace-icon.svg"` or `"workspace-icon.png"`, a file in the content folder. Set by uploading one in **Workspace settings** (square, up to 256 KB). Without one, the name's first letter sits on a tile. |
| `ui.subtitle` | your design system's name | Not shown at the moment; the sidebar shows only the name. |
| `ui.theme` | `"studio"` | The interface's own look: plain shadcn neutral in the platform's interface font. `"design-system"` gives it your design system's colours; the font, type scale and corners stay Dex's. Files always use your design system. |
| `ui.icons` | `"lucide"` | The interface's icons: `"lucide"`, `"phosphor"` or `"hugeicons"`. Every icon swaps at once. `create` always writes it (`--icons`): your `components.json`'s `iconLibrary`, else the set in your dependencies, else Lucide. Lucide comes with Dex; Phosphor and Hugeicons are the project's own (optional peers), which `create` installs when they are missing. A set the project lacks falls back to Lucide, and `dex doctor` says how to install it. |
| `ui.locale` | the browser's | The interface's language. `"pseudo"` shows every string accented and padded, to check nothing is missed; `?locale=` in the address overrides it. |
| `ui.accent` | Tailwind's blue-600 | The studio's accent: selection, pins and the tool in use. Any CSS colour. |
| `ui.components` | none | A module whose exports replace parts of the interface (below). |
| `ui.primitives` | the studio's own | Your components for the interface's buttons, menus, dialogs and inputs (below). |
| `ui.chromeTheme` | none | With `ui.theme: "design-system"`, the interface's colours mapped to your tokens when they use other names than shadcn's: `{ primary: "var(--brand-action)" }`. |

## Next's built-ins in views

Components written for a Next app use what Next's bundler gives them: `process.env`, `next/link`, `next/image`, `next/font` and the router's hooks. Views get them from `next()`, which `create` writes into a Next app's config, and nothing else about Next goes into your project:

```ts
import { defineConfig } from "@dexhq/canvas/config";
import { next } from "@dexhq/canvas/next";

export default defineConfig({
  content: "./studio",
  plugins: [next()],
});
```

- `process.env` has `NODE_ENV` and the `NEXT_PUBLIC_` variables of the project's `.env` files (`.env`, `.env.local`, `.env.development` and so on), as Next gives them to the browser, and no other variable.
- `next/link` is Next's own. A link to another view moves the frame there, as any link in a view does.
- `next/image` renders an `<img>` of the image itself, sized and laid out as Next lays it out, since `/_next/image` needs Next's server.
- `next/font/google` and `next/font/local` give no class and load no font files. A Google font's `style.fontFamily` names its family, which shows where the font is installed.
- `next/navigation` and `next/router` give a router at `/` whose moves go nowhere, with empty search params.

An app of its own in a monorepo gets `next()` too when its design system's package depends on `next` (`@dub/ui`). A config written before `next()` existed has none in `plugins`. In a Next app, `dex dev` applies it anyway, and `dex doctor` notes the lines to add. Projects that aren't Next apps get none of it.

## A provider around every view

Some design systems render only inside a provider: Mantine's `MantineProvider`, Chakra's `ChakraProvider`, Radix Themes' `Theme`, or MUI's `ThemeProvider` with your theme. Point `designSystem.provider` at a module, relative to the config or a package's (`"@acme/ui/provider"`), whose default export takes `children` and wraps them:

```tsx
// studio/provider.tsx, with provider: "./studio/provider.tsx"
import "@mantine/core/styles.css";
import { MantineProvider } from "@mantine/core";
import type { ReactNode } from "react";
import { theme } from "../src/theme";

export default function Provider({ children }: { children: ReactNode }) {
  return <MantineProvider theme={theme}>{children}</MantineProvider>;
}
```

Every view renders inside it, wherever it renders, so views never wrap themselves; the generated `AGENTS.md` tells agents so. Without one, a view renders exactly as it is, with no element around it. `dex doctor` checks the module is there and has a default export. For Mantine, Chakra UI and Radix Themes, `create` writes this file with the library's provider and the default theme (`--provider <module>` names your own instead, `--provider none` skips it); pass it your theme.

## Make the interface yours

The interface has a plain look of its own, so it stays out of the way of your work: shadcn's neutral theme in the platform's interface font, a compact type scale and Tailwind's spacing. Set `ui.theme: "design-system"` for it to take your design system's colours instead. To replace parts of it, export React components from the `ui.components` module:

```tsx
// studio/ui.tsx
export const Logo = () => <img alt="" src="/logo.svg" width={20} />;
export const HomeIntro = () => <p>Start from the Checkout file.</p>;
```

| Export | Replaces |
| --- | --- |
| `Logo` | The workspace's icon beside its name in the sidebar. It shows in place of `ui.workspaceIcon`. |
| `HomeIntro` | The panel at the top of the Recents page. |

Anything you do not export keeps its default.

## Your components in the interface

The interface's buttons, menus, dialogs and inputs are shadcn components on Base UI. If your project has the same, the studio uses yours instead of carrying a second copy:

```ts
ui: { primitives: "@/components/ui" }, // or "./src/components/ui", or "@acme/ui/shadcn"
ui: { primitives: true }, // the components in designSystem.components
```

Each component you have is used; the studio's own fills any gap. `create` sets this when your `components.json` uses a Base UI style (`base-…`), and sets `ui.icons` to the set its `iconLibrary` names, so the interface's icons match your components'. The shadcn starter `create` makes in an empty folder is set up this way. Without it, the studio's components stay inside the package in `node_modules`, out of your project and out of reach of your files: `dex check` flags any file that imports them.
