# Install a local extension

First of all, download the extension

Create a `packages/` directory inside of your theme's root.&#x20;

{% hint style="info" %}
Conventionally, the directory to store packages is called `packages`, but you may use another name if you are willing to.
{% endhint %}

Put the extension into the `packages/<package name>` directory. Make sure that you have a `packages/<package name>/package.json` file present alongside all the other extension's contents, that means that you have unpacked the extension correctly.

```bash
.
├── 📁 packages/
│   ├── 📁 @somebody/        # All extensions of this scope will be in this dir 
│   │   └── 📁 extension1/   # This extension is a scoped package
│   │       ├── ...
│   │       └── package.json
│   └── 📁 extension2/       # This extension is not a scoped package
│       ├── ...
│       └── package.json
├── 📁 src
└── package.json
```

Add the following scripts to the `scripts` section of your theme's `package.json` file. This is necessary for your package to be automatically symlinked into the `node_modules` directory of your theme, each time after any manipulation with dependencies

{% tabs %}
{% tab title="nextjs-scripts" %}

```javascript
{
    "scripts": {
        "postinstall": "nextjs-scripts link",
        "postupdate": "nextjs-scripts link"
    }
}
```

{% endtab %}

{% tab title="cra-scripts" %}

```javascript
{
    "scripts": {
        "postinstall": "cra-scripts link",
        "postupdate": "cra-scripts link"
    }
}
```

{% endtab %}

{% tab title="node-scripts" %}

```javascript
{
    "scripts": {
        "postinstall": "node-scripts link",
        "postupdate": "node-scripts link"
    }
}
```

{% endtab %}
{% endtabs %}

Add the extension to the **dependencies** of your theme, as follows:

{% code title="./package.json" %}

```javascript
{
    "dependencies": {
        "@somebody/extension1": "file:./packages/@somebody/extension1".
        "extension2": "file:./packages/extension2".
    }
}
```

{% endcode %}

[Enable](/install-an-extension/enable-or-disable-an-extension.md) the extension:

{% code title="package.json" %}

```javascript
{
    "mosaic": {
        "extensions": {
            "@somebody/extension1": true,
            "extension2": false
        }
    }
}
```

{% endcode %}

Update the symlinks by running the following command

{% tabs %}
{% tab title="npm" %}

```bash
npm run postinstall
```

{% endtab %}

{% tab title="yarn" %}

```bash
yarn postinstall
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.mosaic.js.org/install-an-extension/use-a-local-extension.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
