# Running JavaScript projects

Source: https://browsercode.io/docs/ide/javascript

Index of every BrowserCode page: https://browsercode.io/llms.txt

Templates, repo cloning, native dependency overrides and previews.

JavaScript projects run on BrowserPod, in a browser MicroVM with Node.js 22, a shell, npm, pnpm and a live preview. You can start from a template or clone a public GitHub repo.

## Templates

[Vite](https://browsercode.io/ide?framework=vite) on its own, or with [React](https://browsercode.io/ide?framework=react), [Svelte](https://browsercode.io/ide?framework=svelte) or [Vue](https://browsercode.io/ide?framework=vue), plus [Next.js](https://browsercode.io/ide?framework=nextjs), [Nuxt](https://browsercode.io/ide?framework=nuxt) and [Express](https://browsercode.io/ide?framework=express). Templates are preconfigured for BrowserCode, so you can start editing right away.

The React, Svelte and Vue templates are plain Vite projects, not Create React App or SvelteKit. To use one of those, clone a starter repo. Next.js and Nuxt have their own templates.

## Cloning a repo

Paste a GitHub URL into the clone field on the [JavaScript page](https://browsercode.io/ide). BrowserCode clones the repo, detects whether it uses npm or pnpm, installs dependencies and runs the `dev` script. If there is no `dev` script it runs `start`, and if neither exists it stops with an error.

You can also link directly to a clone, for example with an "Open in BrowserCode" link in a README. The URL follows the structure of the GitHub URL. See [Linking to BrowserCode](https://browsercode.io/docs/linking), which also covers branch names that contain a slash, such as `release/1.0`.

## Native binaries

Your code runs on WebAssembly, not on x64 or arm64. npm packages that ship prebuilt binaries for a specific CPU cannot run, and many popular build tools do.

The fix is an override that replaces the package with its WebAssembly build. BrowserCode applies the common overrides when it clones a repo, and lists each change in the Output tab:

-   `esbuild` and `rollup` are replaced with their Wasm builds.
-   Vite 8.2+ and Nuxt 4+ get the Rolldown Wasm binding.
-   Turbopack is turned off for Next.js, because it is native-only.

BrowserCode does not add `@next/swc-wasm-nodejs` for Next.js. Add it yourself, at the same version as `next`.

If you add overrides yourself, put them where your package manager reads them:

-   npm reads `overrides` in `package.json`.
-   pnpm reads `overrides` in `pnpm-workspace.yaml` and ignores the `package.json` field.

If an override has no effect, check that it is in the right file.

Some packages, such as `sharp` and `bcrypt`, have no WebAssembly build and do not work in BrowserCode. Use a pure JavaScript alternative instead.

## Previewing your app

When a dev server starts listening on a port, the Preview pane shows it. This works whether the server listens on `localhost` or `0.0.0.0`, so templates and cloned repos need no changes.

Every port your project listens on gets its own preview URL, so an API and a frontend get one each. Do not hardcode `http://localhost:3000` in client code: that address exists inside the MicroVM, not in the browser that displays your app. Use a relative path instead. In the terminal, localhost works as usual, so you can `curl` your own server.

## Troubleshooting

Most failures come from the project needing something the MicroVM cannot provide. Fix these in the project:

-   An error that names a platform, such as `@esbuild/linux-x64`, means a native binary. Add an override.
-   An override with no effect is probably in the wrong file for your package manager.
-   A frontend that loads but cannot reach its API is probably calling a hardcoded `localhost` URL. Use a relative path.
-   An error resolving a hostname means the host is not on the network allowlist. See the [overview](https://browsercode.io/docs).

If none of these apply, [open an issue](https://github.com/leaningtech/browsercode/issues/new) and include the repo you were booting. BrowserCode is open source, so you can also inspect the code or [run a modified copy](https://browsercode.io/docs/self-hosting).

- [Next Running Java projects](https://browsercode.io/docs/ide/java)
