npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

hxdb-vue

v0.1.2

Published

Vue/Nuxt client library for HxDB - Query your database with Vue composables

Readme

hxdb-vue

Vue/Nuxt client library for HxDB — query your database with Vue composables.

Install

npm install hxdb-vue

Quick Start

Option A: Vue Plugin (recommended)

The baseUrl defaults to https://hxdb-test.kubo.hexabase.io, so you only need to provide your API key:

// main.ts
import { createApp } from "vue";
import { HxDBPlugin } from "hxdb-vue";
import App from "./App.vue";

const app = createApp(App);

app.use(HxDBPlugin, {
  apiKey: "your-api-key", // from HxDB Settings page
});

app.mount("#app");

To connect to a different HxDB instance, override baseUrl:

app.use(HxDBPlugin, {
  baseUrl: "http://localhost:5213",
  apiKey: "your-api-key",
});

Option B: Nuxt Plugin

// plugins/hxdb.ts
import { HxDBPlugin } from "hxdb-vue";

export default defineNuxtPlugin((nuxtApp) => {
  nuxtApp.vueApp.use(HxDBPlugin, {
    apiKey: "your-api-key",
  });
});

Option C: Component-level provide

<!-- ParentComponent.vue -->
<script setup lang="ts">
import { provideHxDB } from "hxdb-vue";

provideHxDB({
  apiKey: "your-api-key",
});
</script>

Query with useHxDB

<script setup lang="ts">
import { useHxDB } from "hxdb-vue";

interface User {
  id: number;
  name: string;
  email: string;
}

const { data, columns, loading, error, executionTimeMs, refetch } = useHxDB<User>(
  "SELECT * FROM users LIMIT 10"
);
</script>

<template>
  <p v-if="loading">Loading...</p>
  <p v-else-if="error">Error: {{ error }}</p>
  <div v-else>
    <p>Fetched in {{ executionTimeMs }}ms</p>
    <button @click="refetch">Refresh</button>
    <table>
      <thead>
        <tr>
          <th v-for="col in columns" :key="col">{{ col }}</th>
        </tr>
      </thead>
      <tbody>
        <tr v-for="user in data" :key="user.id">
          <td>{{ user.id }}</td>
          <td>{{ user.name }}</td>
          <td>{{ user.email }}</td>
        </tr>
      </tbody>
    </table>
  </div>
</template>

Reactive Queries

Pass a getter function to make the query reactive:

<script setup lang="ts">
import { ref } from "vue";
import { useHxDB } from "hxdb-vue";

const limit = ref(10);

const { data, loading } = useHxDB(
  () => `SELECT * FROM users LIMIT ${limit.value}`
);

// Query re-executes automatically when limit changes
</script>

<template>
  <select v-model="limit">
    <option :value="10">10 rows</option>
    <option :value="50">50 rows</option>
    <option :value="100">100 rows</option>
  </select>
  <p v-if="loading">Loading...</p>
  <ul v-else>
    <li v-for="(row, i) in data" :key="i">{{ row }}</li>
  </ul>
</template>

Conditional Execution

<script setup lang="ts">
import { ref } from "vue";
import { useHxDB } from "hxdb-vue";

const shouldFetch = ref(false);

const { data, loading } = useHxDB(
  "SELECT * FROM orders",
  { enabled: () => shouldFetch.value }
);
</script>

<template>
  <button @click="shouldFetch = true">Load Orders</button>
  <p v-if="loading">Loading...</p>
  <pre v-else>{{ data }}</pre>
</template>

API Reference

HxDBPlugin

Vue plugin for global installation.

app.use(HxDBPlugin, {
  baseUrl: "https://hxdb-test.kubo.hexabase.io",  // optional, this is the default
  apiKey: "your-api-key",   // required
  headers: { ... },          // optional custom headers
});

useHxDB<T>(query, options?)

Composable for executing SQL queries with reactive state.

const state = useHxDB<User>("SELECT * FROM users", {
  enabled: true, // boolean or () => boolean
});

Returns HxDBQueryState<T>:

| Field | Type | Description | |-------|------|-------------| | data | Ref<T[]> | Query result rows | | columns | Ref<string[]> | Column names | | loading | Ref<boolean> | Loading state | | error | Ref<string \| null> | Error message | | executionTimeMs | Ref<number \| null> | Query execution time | | rowsAffected | Ref<number> | Rows affected (INSERT/UPDATE/DELETE) | | refetch | () => Promise<void> | Re-execute the query |

provideHxDB(config)

Provide the client at component level (alternative to plugin).

useHxDBClient()

Access the raw HxDBClient instance from the injection context.

HxDBClient

Standalone client for use outside components (API routes, scripts, etc).

import { createHxDBClient } from "hxdb-vue";

// Uses default URL (https://hxdb-test.kubo.hexabase.io)
const client = createHxDBClient({ apiKey: "your-api-key" });

// Or specify a custom URL
// const client = createHxDBClient({ baseUrl: "http://localhost:5213", apiKey: "your-api-key" });

const { data, columns } = await client.query("SELECT * FROM users LIMIT 5");
const datasets = await client.datasets();

License

MIT