# Anatomy of an extension

## Package.json

For NPM package to be considered an [extension](broken://pages/-MZIMMdiBcQjgReqHOyM#what), it must have a `package.json` field `mosaic.type` equal to `extension`.

It is important for Mosaic module to be recognized in order for [namespaces](/develop-an-extension/namespaces.md) to work properly (get transpiled into logic).

```javascript
{
    "mosaic": {
        "type": "extension"
    }
    ...
}
```

## File structure

Mosaic has a minimal requirement towards the folder structure of a module.&#x20;

All of the `.plugin.js` files ([plugin declaration files](/develop-an-extension/anatomy-of-an-extension.md#plugin-declaration-files)) should be located under the `src/plugin` directory. All the subdirectories of this one are scanned for them, but no other places.

It's recommended to split all of your other logic into separate directories of the `src` directory. All of the functionality outside of `src` will not be available for [shadowing](/themes/parent-themes.md).

```bash
├── 📁  node_modules
├── 📄  package.json
└── 📁  src
   ├── ...        # Any own logic of your extension here
   └── 📁  plugin # Plugging logic here!
       ├── 📄  some.plugin.js
       └── 📄  other.plugin.ts
```


---

# 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/develop-an-extension/anatomy-of-an-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.
