> ## Documentation Index
> Fetch the complete documentation index at: https://honeydew.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# JavaScript

Here are some general guidelines for connecting JavaScript or TypeScript code
to the Honeydew JDBC interface.

Honeydew can integrate with JavaScript and TypeScript applications using the
[Trino JavaScript client](https://www.npmjs.com/package/trino-client) package.

<Note>
  Before you start, make sure you have the
  [Trino JavaScript client](https://www.npmjs.com/package/trino-client) installed:

  ```bash theme={null}
  npm install trino-client
  ```
</Note>

<Note>
  If your organization uses a custom hostname for the JDBC connection,
  you can locate it in the Honeydew UI, under the **JDBC** section in **Settings**.
</Note>

<Tip>
  It is recommended to use an [API Key](/docs/access-control/api-keys)
  for setting up the connection.
</Tip>

```javascript theme={null}
import {Trino, BasicAuth} from 'trino-client';

const trino = Trino.create({
  // If your organization uses a custom hostname for the JDBC connection,
  // you can locate it in the Honeydew UI, under the JDBC section in Settings.
  server: 'https://jdbc.honeydew.cloud',

  // For credentials, pass the API key (or a Honeydew username),
  // and the API secret (or the Honeydew password).
  auth: new BasicAuth('<api key name>', '<api key secret>'),

  // catalog is based on the Honeydew "workspace" and "branch"
  // you would like to connect to.
  // Omit the branch value if connecting to "prod".
  // For example, for workspace "tpch", branch "prod",
  // the value would be: "tpch".
  catalog: '<workspace>__<branch>',

  schema: 'domains',
});

// List available domains
const tablesIter = await trino.query('SHOW TABLES FROM domains');
for await (const result of tablesIter) {
  console.log(result.data);
}

// Query a domain
const queryIter = await trino.query(
  'SELECT "orders.o_orderdate", AGG("lineitem.revenue") FROM domains.my_domain'
);
for await (const result of queryIter) {
  console.log(result.data);
}
```
