> ## Documentation Index
> Fetch the complete documentation index at: https://persian-tools.usestrict.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Installation

> Learn how to install Persian Tools in your project

# Installation

Persian Tools is available via a npm package and supports multiple JavaScript or TypeScript environments, including Node.js, Bun, and modern browsers.

## Package Manager Installation

<CodeGroup>
  ```bash npm theme={null}
  npm install @persian-tools/persian-tools
  ```

  ```bash yarn theme={null}
  yarn add @persian-tools/persian-tools
  ```

  ```bash pnpm theme={null}
  pnpm add @persian-tools/persian-tools
  ```

  ```bash bun theme={null}
  bun add @persian-tools/persian-tools
  ```
</CodeGroup>

## CDN Usage

For browser, environments, you can use Persian Tools directly from a CDN:

<CodeGroup>
  ```html jsdelivr theme={null}
  <script src="https://cdn.jsdelivr.net/npm/@persian-tools/persian-tools@latest/build/cjs/persian-tools.js"></script>
  ```

  ```html unpkg theme={null}
  <script src="https://unpkg.com/@persian-tools/persian-tools@latest/build/cjs/persian-tools.js"></script>
  ```
</CodeGroup>

## Requirements

<Card title="Compatibility" icon="check-circle">
  * **Node.js**: 14+ (ESM and CommonJS support) - **Bun**: Latest versions - **Browsers**: Modern browsers with ES2018+
    support - **TypeScript**: 4.0+ (optional, but recommended)
</Card>

## Bundle Sizes

Persian Tools is designed to be lightweight and tree-shakable:

<AccordionGroup>
  <Accordion title="📦 Full Bundle" icon="package">
    * **Minified**: \~127KB gzipped
    * **Uncompressed**: \~830KB
    * Contains all 27+ utilities
  </Accordion>

  <Accordion title="🌳 Tree-Shaken" icon="tree">
    * **Single utility**: \~1-3KB gzipped
    * **Typical usage**: \~8-15KB gzipped
    * Modern bundlers automatically optimize
  </Accordion>
</AccordionGroup>

## Environment Support

<CardGroup cols={2}>
  <Card title="Node.js & Bun" icon="server">
    Full support for server-side applications with both CommonJS and ESM imports
  </Card>

  <Card title="Browsers" icon="globe">
    Works in all modern browsers with native ES modules or bundled applications
  </Card>

  <Card title="TypeScript" icon="code">
    First-class TypeScript support with comprehensive type definitions
  </Card>

  <Card title="Bundlers" icon="box">
    Compatible with Webpack, Vite, Rollup, and other modern bundlers
  </Card>
</CardGroup>

## Verification

After installation, verify everything works correctly:

```typescript theme={null}
import { numberToWords } from "persian-tools";

console.log(numberToWords(1234)); // "یک هزار و دویست و سی و چهار"
```

<Note>
  If you encounter any installation issues, please check our [troubleshooting
  guide](https://github.com/persian-tools/persian-tools/issues) or create a new issue on GitHub.
</Note>

## Next Steps

<CardGroup cols={2}>
  <Card title="Basic Usage" icon="play" href="/getting-started/usage">
    Learn the fundamentals of using Persian Tools
  </Card>

  <Card title="Examples" icon="code-simple" href="/getting-started/examples">
    Explore practical examples and use cases
  </Card>
</CardGroup>
