> ## Documentation Index
> Fetch the complete documentation index at: https://docs.opengeometry.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Installation

> Install opengeometry and three, and serve the WebAssembly kernel and the display worker.

```bash theme={null}
npm install opengeometry three
```

* `three` is a peer dependency. Versions `>=0.168.0 <0.185.0` are supported.
* The package is ES modules only. Its TypeScript types are included. They use the types of `three`, which `three` does not ship: in a TypeScript project, also run `npm install --save-dev @types/three`.

## Serve the two files

The package ships two files that your page must fetch at run time:

| File | What it is |
| - | - |
| `opengeometry_bg.wasm` | The kernel, compiled to WebAssembly |
| `tessellation-worker.js` | The web worker that makes the display meshes |

With no arguments, `OpenGeometry.create()` looks for both files next to the package's own `index.js`. A bundler that moves or rewrites `index.js` breaks that lookup. The dependable way is to copy both files into the folder that your site serves at its root, and pass their addresses to `create`.

In Vite, that folder is `public/`:

```bash theme={null}
cp node_modules/opengeometry/opengeometry_bg.wasm node_modules/opengeometry/tessellation-worker.js public/
```

Then start the kernel once, before you make a body:

```ts theme={null}
import { OpenGeometry } from 'opengeometry';

await OpenGeometry.create(
  { wasmURL: '/opengeometry_bg.wasm' },
  { workerURL: '/tessellation-worker.js' },
);
```

`workerURL` goes in the second argument, not the first.

## Vite settings

Vite pre-bundles dependencies. Keep `opengeometry` out of that step, and allow top-level `await` in the build:

```js theme={null}
import { defineConfig } from 'vite';

export default defineConfig({
  optimizeDeps: { exclude: ['opengeometry'] },
  build: { target: 'esnext' },
});
```

If your build cannot use top-level `await`, put the code after the imports in an `async` function and call it.

## Without a worker

Pass `{ tessellation: 'inline' }` to make the display meshes on the main thread. You then need no worker file:

```ts theme={null}
import { OpenGeometry } from 'opengeometry';

await OpenGeometry.create({ wasmURL: '/opengeometry_bg.wasm' }, { tessellation: 'inline' });
```

For Node, see [Run in Node](https://docs.opengeometry.io/opengeometry/guides/run-in-node.md).

## Check the installed line

```bash theme={null}
npm ls opengeometry
```

The 2.0 line has a different API. Code that uses `Cuboid`, `Vector3` or `setPlacement` is written for 2.0.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.