> ## 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 set up your development environment

## Install OpenGeometry

Install the OpenGeometry package using your preferred package manager:

<CodeGroup>
  ```bash npm theme={null}
  npm install opengeometry
  ```

  ```bash yarn theme={null}
  yarn add opengeometry
  ```

  ```bash pnpm theme={null}
  pnpm add opengeometry
  ```
</CodeGroup>

## Peer Dependencies

OpenGeometry requires Three.js for 3D rendering. Install it as a peer dependency:

<CodeGroup>
  ```bash npm theme={null}
  npm install three
  ```

  ```bash yarn theme={null}
  yarn add three@
  ```

  ```bash pnpm theme={null}
  pnpm add three
  ```
</CodeGroup>

## TypeScript Support

If you're using TypeScript, install the Three.js type definitions:

<CodeGroup>
  ```bash npm theme={null}
  npm install --save-dev @types/three
  ```

  ```bash yarn theme={null}
  yarn add --dev @types/three
  ```

  ```bash pnpm theme={null}
  pnpm add --dev @types/three
  ```
</CodeGroup>

OpenGeometry includes built-in TypeScript definitions, so no additional types are needed for the core library.

## WebAssembly Setup

OpenGeometry uses WebAssembly for high-performance geometric computations. The WASM file is needed when the code is executed.

### Development Setup

During development, the WASM file will be loaded from your `node_modules` directory. No additional configuration is needed.

### Production Setup

For production builds, you'll need to ensure the WASM file is accessible. Most modern bundlers (Vite, webpack, etc.) handle this automatically.

#### Vite Configuration

Vite automatically handles WASM files. No additional configuration is required.

#### Webpack Configuration

If using webpack 5+, add the following to your `webpack.config.js`:

```javascript theme={null}
module.exports = {
  experiments: {
    asyncWebAssembly: true,
  },
};
```

## Verify Installation

Create a simple test file to verify your installation:

```typescript theme={null}
import { OpenGeometry, Cuboid, Vector3 } from 'opengeometry';
import * as THREE from 'three';

// Initialize OpenGeometry
await OpenGeometry.create({});

// Create a simple test cuboid
const cuboid = new Cuboid({
  center: new Vector3(0, 0, 0),
  width: 2,
  height: 1,
  depth: 1,
  color: 0x4460ff
});

console.log('OpenGeometry cuboid created:', cuboid);
console.log('OGID:', cuboid.ogid);
```

<Note>
  OpenGeometry uses WebAssembly which loads automatically. The shapes are ready to use immediately after import.
</Note>

## Next Steps

Now that you have OpenGeometry installed, you're ready to create your first 3D geometry:

<Card title="Quickstart Guide" icon="rocket" href="/OpenGeometry/quickstart">
  Follow the quickstart guide to create your first 3D shape
</Card>
