# Setup

### 1. Find an extension.

For this guide, we will use a custom function. You can find one on your own, or use our [Extension Finder](https://coolstone.dev/dubnium/extensions/).

{% code title="createHelloWorld.js" lineNumbers="true" %}

```javascript
(db) => {
if(!db) throw new Error("This extension requires database permissions")
db.create('hello', `Hello, World!`)
}
```

{% endcode %}

### 2. Define permissons

{% code lineNumbers="true" %}

```javascript
const { extensionPermissions } = require('dubnium')
const permissions = new extensionPermissions(true, false, [ 'edit' ]) 
```

{% endcode %}

<table><thead><tr><th>Parameter</th><th>About</th><th data-type="checkbox">Required</th></tr></thead><tbody><tr><td>record</td><td>Allow access to the Record when extending the record editor API</td><td>true</td></tr><tr><td>database</td><td>Allow access to the entire database when extending the database.</td><td>true</td></tr><tr><td>filterList</td><td>An array of function names to omit from an extension.</td><td>false</td></tr></tbody></table>

### 3. Add to Dubnium

{% code lineNumbers="true" %}

```javascript
db.extend('name', require('./extension'), permissions)
```

{% endcode %}

{% code lineNumbers="true" %}

```javascript
db.get('tag').extend('name', require('./extension'), permissions)
```

{% endcode %}

### 4. Use the extension

{% code lineNumbers="true" %}

```javascript
db.name()
```

{% endcode %}

### Full Example

{% code title="createHelloWorld.js" lineNumbers="true" %}

```javascript
db.extend('createHelloWorld', (db) => {
if(!db) throw new Error("This extension requires database permissions")
db.create('hello', `Hello, World!`)
}, new extensionPermissions(false, true))

db.createHelloWorld()
```

{% endcode %}


---

# 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://db.coolstone.dev/3/extensions/setup.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.
