# What Is the Build Process for Supermemory? A Complete Technical Guide

> Discover the Supermemory build process. Learn how Bun orchestrates the Turbo monorepo to compile TypeScript, bundle the Next.js UI, and upload Sentry source maps. Get the complete technical guide.

- Repository: [supermemory/supermemory](https://github.com/supermemoryai/supermemory)
- Tags: how-to-guide
- Published: 2026-03-25

---

**Supermemory uses a Turbo monorepo orchestrated by Bun, where `bun run build` triggers a cascading build pipeline that compiles TypeScript, bundles the Next.js Web UI, and uploads Sentry source maps.**

The build process for Supermemory is defined in the `supermemoryai/supermemory` repository as a deterministic, cache-aware pipeline designed for a modern TypeScript monorepo. It leverages **Turbo** for task orchestration and **Bun** for package management to compile multiple applications—including the Web UI, MCP server, and browser extensions—from a unified workspace structure.

## Monorepo Architecture and Build Tools

### Turbo Configuration

The build process is centered on the root **[`turbo.json`](https://github.com/supermemoryai/supermemory/blob/main/turbo.json)**, which defines the task dependency graph. The `build` task declares `"dependsOn": ["^build"]`, instructing Turbo to construct a topological build order where dependencies compile before dependents. This configuration caches build outputs—specifically `.next/**` directories for Next.js applications—enabling incremental builds that skip unchanged workspaces.

### Package Manager Setup

The root **[`package.json`](https://github.com/supermemoryai/supermemory/blob/main/package.json)** explicitly declares `"packageManager": "bun@1.3.4"`, locking the repository to a specific Bun version. This ensures that `bun install` resolves and hoists dependencies consistently across the monorepo's shared packages (`@repo/*`) and applications (`apps/*`).

## Step-by-Step Build Pipeline

### 1. Dependency Installation

Initialize the workspace by installing all packages in one pass. This command respects the Bun lockfile and populates `node_modules` across the entire monorepo:

```bash
bun install

```

### 2. Root Build Orchestration

Execute the full build from the repository root. The **[`package.json`](https://github.com/supermemoryai/supermemory/blob/main/package.json)** defines the entry point as:

```json
"build": "turbo run build"

```

Running `bun run build` invokes Turbo, which recursively executes the `build` script in every workspace that defines one. For example, Turbo will identify that `@repo/lib` and `@repo/validation` have no build scripts and skip them, while targeting `apps/web` and `apps/mcp`.

### 3. Individual Application Builds

Each application defines its own build logic. In **[`apps/web/package.json`](https://github.com/supermemoryai/supermemory/blob/main/apps/web/package.json)**, the Web UI uses Next.js:

```json
"build": "next build"

```

This command generates static-site pages, serverless functions, and client bundles into the `apps/web/.next/` directory. Similarly, other apps in the `apps/` directory execute their respective build commands if defined.

### 4. Post-Build Source Map Upload

After the primary build succeeds, the root **[`package.json`](https://github.com/supermemoryai/supermemory/blob/main/package.json)** automatically triggers a post-build hook:

```json
"postbuild": "bun run sentry:sourcemaps"

```

This script uploads source maps to Sentry for error tracking, ensuring production stack traces are properly symbolized without requiring manual intervention.

## Building Specific Applications

### Web UI (Next.js)

To build only the Web UI without triggering the full monorepo pipeline, navigate to the application directory:

```bash
cd apps/web
bun run build

```

This executes `next build` directly, producing optimized static assets in `.next/`. Note that this requires shared packages (`@repo/ui`, `@repo/lib`) to be available, as the Web UI imports these internal dependencies for components and validation logic.

### Cloudflare Workers Packaging

The Web app supports deployment to Cloudflare Workers via **`opennextjs-cloudflare`**. The **[`apps/web/package.json`](https://github.com/supermemoryai/supermemory/blob/main/apps/web/package.json)** includes specialized scripts for this workflow:

```json
"preview": "opennextjs-cloudflare && wrangler dev",
"deploy": "opennextjs-cloudflare && wrangler deploy",
"upload": "opennextjs-cloudflare && wrangler deploy"

```

These commands transform the Next.js build output into a Cloudflare-compatible format before deployment.

## Quality Assurance and Type Safety

### Type Checking

Before or after building, validate TypeScript across all workspaces using the Turbo task defined in **[`turbo.json`](https://github.com/supermemoryai/supermemory/blob/main/turbo.json)**:

```bash
bun run check-types

```

This executes `turbo run check-types`, which typically runs `tsc --noEmit` (or the package-specific type-check script) to catch type errors without emitting compiled files.

### Linting and Formatting

Enforce code standards using the Biome toolchain. The root **[`package.json`](https://github.com/supermemoryai/supermemory/blob/main/package.json)** provides a unified linting command:

```bash
bun run format-lint

```

This runs `biome check --write` across the entire repository, auto-fixing formatting and lint violations in shared packages and applications alike.

## Summary

- The build process for Supermemory is orchestrated by **Turbo** with **Bun** as the package manager, defined in the root **[`package.json`](https://github.com/supermemoryai/supermemory/blob/main/package.json)** and **[`turbo.json`](https://github.com/supermemoryai/supermemory/blob/main/turbo.json)**
- Running `bun run build` executes `turbo run build`, which respects dependency graphs (`^build`) and caches outputs like `.next/**`
- The **Web UI** in `apps/web/` compiles using `next build`, producing static assets suitable for Vercel or Cloudflare Workers
- **Sentry source maps** upload automatically via the `postbuild` hook in the root configuration
- Separate Turbo tasks for **`check-types`** and **`format-lint`** ensure type safety and code quality without blocking the production build

## Frequently Asked Questions

### What package manager does Supermemory use?

Supermemory uses **Bun** version 1.3.4 as its package manager, specified in the root [`package.json`](https://github.com/supermemoryai/supermemory/blob/main/package.json) under the `"packageManager"` field. This ensures that all dependency installation and script execution use Bun's native runtime and lockfile for consistent, fast builds across development environments.

### How does Turbo handle build dependencies in the monorepo?

According to the [`turbo.json`](https://github.com/supermemoryai/supermemory/blob/main/turbo.json) configuration, the `build` task declares a dependency on `"^build"`, which tells Turbo to build all workspace dependencies before building the current package. This creates a deterministic, topologically sorted build order where shared packages compile first, and Turbo caches the resulting `.next/**` directories to skip redundant work in subsequent runs.

### Can I build only the Web UI without compiling the entire monorepo?

Yes. Navigate to `apps/web/` and run `bun run build` to execute `next build` directly for the Web UI only. This bypasses the full monorepo build but requires that shared packages (`@repo/*`) already be built or available, as the Web UI depends on them for reusable UI components and validation logic.

### How are source maps handled during the build process?

After the root build completes successfully, the `postbuild` script in the root [`package.json`](https://github.com/supermemoryai/supermemory/blob/main/package.json) automatically runs `bun run sentry:sourcemaps`. This uploads source maps to Sentry for error tracking, ensuring that production stack traces in the Web UI and other applications are properly symbolized without requiring manual file uploads.