> For the complete documentation index, see [llms.txt](https://docs.bluzelle.com/developers/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.bluzelle.com/developers/bluzeller2/deploy-your-dapps/blzjs.md).

# JS

[![Build Status](https://travis-ci.org/bluzelle/blzjs.svg?branch=devel)](https://travis-ci.org/bluzelle/blzjs) [![Coverage Status](https://coveralls.io/repos/github/bluzelle/blzjs/badge.svg)](https://coveralls.io/github/bluzelle/blzjs)&#x20;

**blzjs** is a Typescript/JavaScript library that can be used to access the Bluzelle database service.

## Installation

```
yarn add bluzelle
or
npm install bluzelle
```

There are two versions of the bluzelle library. `bluzelle-node.js` and `bluzelle-js.js`.\
By default the NodeJS version will be used.

#### To use the NodeJS version

```
import { bluzele } from 'bluzelle';
or
const { bluzelle } = require('bluzelle');
```

#### To use the pure JS version

```
import { bluzele } from 'bluzelle/lib/bluzelle-js';
or
const { bluzelle } = require('bluzelle/lib/bluzelle-js');
```

#### To load additional Typescript definitions

```typescript
import {bluzelle, API, BluzelleConfig} from 'bluzelle'
```

```typescript
import {bluzelle, API, BluzelleConfig} from 'bluzelle/lib/bluzelle-js'
```

* [API docs](https://github.com/bluzelle/blzjs/tree/devel/client)
* [Download browser version for `<script>` tag](https://github.com/bluzelle/blzjs/raw/devel/client/lib/bluzelle-js.js)
* [Examples](https://github.com/bluzelle/blzjs/tree/devel/samples)
* [REPL (interactive console)](https://github.com/bluzelle/blzjs/tree/devel/repl)

## Quckstart

### Javascript

```javascript
const {bluzelle} = require('bluzelle');

const config = {
    mnemonic: "apology antique such ancient spend narrow twin banner coral book iron summer west extend toddler walnut left genius exchange globe satisfy shield case rose",
    endpoint: "http://testnet.public.bluzelle.com:1317",
    chain_id: 'bluzelle',
    uuid: Date.now().toString()
};

(async () => {
    const bz = await bluzelle(config);

    await bz.create("somekey", "somevalue", {'gas_price': 10})
    console.log(await bz.read("somekey"))
})();
```

### Typescript

```typescript
import {bluzelle, API, BluzelleConfig} from 'bluzelle';

const config: BluzelleConfig = {
    mnemonic: "apology antique such ancient spend narrow twin banner coral book iron summer west extend toddler walnut left genius exchange globe satisfy shield case rose",
    endpoint: "http://testnet.public.bluzelle.com:1317",
    chain_id: 'bluzelle',
    uuid: Date.now().toString()
};

(async () => {
    const bz: API = await bluzelle(config);

    await bz.create("somekey", "somevalue", {'gas_price': 10})
    console.log(await bz.read("somekey"))
})();
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.bluzelle.com/developers/bluzeller2/deploy-your-dapps/blzjs.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
