# How to Run the Build Process for Open-SEO: Complete Guide

> Easily run the build process for Open-SEO with npm run build or pnpm commands. This guide explains Vite bundling and TypeScript type-checking for efficient development.

- Repository: [Every App/open-seo](https://github.com/every-app/open-seo)
- Tags: how-to-guide
- Published: 2026-08-16

---

**Run `npm run build` in the every-app/open-seo repository to execute Vite bundling and TypeScript type-checking, or use `pnpm --dir <workspace> run build` for individual workspace builds.**

Open-SEO is a **pnpm workspaces monorepo** built with Vite and TypeScript. Understanding how to run the build process for open-seo correctly ensures you generate production-ready client assets and Cloudflare Worker bundles. This guide walks through the exact commands, configuration files, and verification steps based on the source code in `every-app/open-seo`.

## Prerequisites: Install Dependencies

Before any build commands work, you must install workspace dependencies.

```bash
pnpm install

```

This command resolves the entire workspace graph defined in [`pnpm-workspace.yaml`](https://github.com/every-app/open-seo/blob/main/pnpm-workspace.yaml) and installs all packages including `vite`, `typescript`, and Cloudflare plugins. The root lockfile guarantees consistent versions across all workspaces.

## Run the Main Build Command

The primary way to run the build process for open-seo is through the root [`package.json`](https://github.com/every-app/open-seo/blob/main/package.json) script:

```bash
npm run build

```

According to the source code in [`package.json`](https://github.com/every-app/open-seo/blob/main/package.json), this executes:

```bash
vite build && tsc --noEmit

```

This two-step process performs:

- **Vite build** – Bundles the TanStack Start client and Cloudflare Workers code using the configuration in [`vite.config.ts`](https://github.com/every-app/open-seo/blob/main/vite.config.ts)
- **TypeScript check** – Runs `tsc --noEmit` to verify type safety without emitting files

The build output appears in two directories:
- `dist/` – Client-side assets
- `worker/` – Cloudflare Worker bundle

## Build Individual Workspaces

For sub-projects like the `badseo` demo app, run the build process for open-seo workspace targets individually:

```bash
pnpm --dir badseo run build

```

This command respects each workspace's own Vite configuration, as documented in [`badseo/README.md`](https://github.com/every-app/open-seo/blob/main/badseo/README.md). The root build also type-checks sub-projects via `tsc --noEmit -p badseo/tsconfig.json`.

## Verify and Preview Your Build

After running the build process for open-seo, confirm success by checking for compiled assets. Then optionally preview locally:

```bash
npm run preview

```

This starts a Vite preview server on **port 3001** (`http://localhost:3001`), letting you inspect the production build before deployment.

## Deploy After Building

With a successful build, deploy to Cloudflare Workers:

```bash
npm run deploy

```

The `deploy` script invokes `wrangler deploy` using the configuration in `wrangler.jsonc`. This pushes the worker bundle along with any database migrations—**build first, deploy second**.

## Self-Hosting Build Variant

For Docker self-hosting, the build process for open-seo uses a dedicated mode:

```bash
vite build --mode selfhost

```

The `Dockerfile.selfhost` consumes this output. Run via `npm run deploy:selfhost` as described in [`docs/SELF_HOSTING_DOCKER.md`](https://github.com/every-app/open-seo/blob/main/docs/SELF_HOSTING_DOCKER.md).

## Key Configuration Files

| File | Purpose |
|------|---------|
| [`package.json`](https://github.com/every-app/open-seo/blob/main/package.json) | Defines `build`, `preview`, and `deploy` scripts |
| [`vite.config.ts`](https://github.com/every-app/open-seo/blob/main/vite.config.ts) | Configures Vite with `@cloudflare/vite-plugin` for worker bundling |
| `wrangler.jsonc` | Cloudflare Workers bindings and routes |
| `Dockerfile.selfhost` | Packages self-hosted builds |
| [`pnpm-workspace.yaml`](https://github.com/every-app/open-seo/blob/main/pnpm-workspace.yaml) | Declares workspace packages |

## Summary

- **Install first**: `pnpm install` resolves the workspace dependency graph
- **Main build**: `npm run build` runs Vite bundling plus TypeScript checking
- **Workspace builds**: `pnpm --dir <path> run build` for individual packages like `badseo`
- **Output locations**: `dist/` (client) and `worker/` (Cloudflare Worker)
- **Preview**: `npm run preview` on port 3001 for local verification
- **Deploy**: `npm run deploy` pushes to Cloudflare after successful build

## Frequently Asked Questions

### What package manager does open-seo use?

**pnpm**. The repository uses pnpm workspaces with a root [`pnpm-workspace.yaml`](https://github.com/every-app/open-seo/blob/main/pnpm-workspace.yaml) file and shared lockfile. All build commands assume pnpm is installed and used for dependency resolution.

### Can I build without type-checking?

The default `npm run build` includes `tsc --noEmit`. To skip type-checking, run `vite build` directly. However, this bypasses the safety check the maintainers intended for production builds.

### Where does the build output go?

Vite places client assets in `dist/` and the Cloudflare Worker bundle in `worker/`, as configured in [`vite.config.ts`](https://github.com/every-app/open-seo/blob/main/vite.config.ts). These paths are referenced by `wrangler.jsonc` during deployment.

### How do I build for self-hosting instead of Cloudflare?

Use `npm run deploy:selfhost` or manually run `vite build --mode selfhost`. The `Dockerfile.selfhost` expects output from this build mode, which differs slightly from the standard Cloudflare-targeted build.