C.W.K.
Stream
Lesson 06 of 06 · published

Tauri Inside a Monorepo

~12 min · tauri, monorepo, structure, workspaces

Level 0Web Tourist
0 XP0/56 lessons0/13 achievements
0/100 XP to next level100 XP to go0% complete
"The default layout is one app at the root. Real projects often want the app to be one folder among many."

Why a Monorepo

The scaffold puts your app at the repo root, which is perfect for a single app. But you may want the Tauri app to live inside a larger repo — alongside a shared component library, a docs site, or a sibling project. That's a monorepo, and Tauri handles it fine; you just point a few paths correctly.

Cinder does exactly this: the Tauri app lives at apps/cinder/, with its native half at apps/cinder/src-tauri/, sitting next to other workspace packages. Nothing about Tauri forces the root layout — it only cares that the config's paths resolve.

The One Rule: Paths Are Relative to src-tauri

The paths in tauri.conf.json — especially frontendDist and devUrl — are interpreted relative to the src-tauri/ directory, not the repo root. In a monorepo where your frontend builds to apps/cinder/dist, frontendDist is still just ../dist because src-tauri/ sits beside dist/. Get this relative-path mental model right and monorepo Tauri stops being mysterious.

Running the CLI from a Workspace

With npm/pnpm/yarn workspaces, you invoke the Tauri CLI scoped to the app package. A root package.json script like npm run tauri --workspace apps/cinder dev runs the app's dev loop from anywhere in the repo. The CLI still finds src-tauri/tauri.conf.json inside that workspace and proceeds normally.

Code

App as one workspace among many·text
A monorepo layout (this is Cinder's actual shape):

repo/
├─ package.json            # workspaces: ["apps/*", "packages/*"]
├─ packages/
│   └─ ui/                 # shared component library
└─ apps/
    └─ cinder/
        ├─ src/            # this app's frontend
        ├─ dist/           # built frontend output
        ├─ package.json
        └─ src-tauri/      # the native half
            ├─ tauri.conf.json   # frontendDist: "../dist"
            └─ src/lib.rs
Driving Tauri from the repo root·json
// root package.json — scope the Tauri CLI to the app workspace.
{
  "workspaces": ["apps/*", "packages/*"],
  "scripts": {
    "tauri": "npm run tauri --workspace apps/cinder",
    "tauri:dev": "npm run tauri dev --workspace apps/cinder",
    "tauri:build": "npm run tauri build --workspace apps/cinder"
  }
}

External links

Exercise

Sketch how you'd move your scaffolded app into apps/myapp/ inside a monorepo. Write the new frontendDist value (hint: it doesn't change if dist still sits beside src-tauri) and the root package.json script you'd add to run it. You're practicing the relative-path reasoning, which is the only real gotcha here.
Hint
If apps/myapp/dist and apps/myapp/src-tauri are siblings, frontendDist stays '../dist'. The root script uses --workspace apps/myapp. The trap is thinking paths are relative to the repo root — they're relative to src-tauri.

Progress

Progress is local-only — sign in to sync across devices.
Spotted a bug or have feedback on this page?Report an Issue

Comments 0

🔔 Reply notifications (sign in)
Sign inPlease sign in to comment.

No comments yet — be the first.