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

@askdb/http-api

v1.0.0-beta.42

Published

AskDB HTTP API: minimal HTTP wrapper around @askdb/core. POST /ask returns validated SQL only.

Readme

@askdb/http-api

Minimal HTTP surface that wraps @askdb/core — no duplicated NL→SQL logic. POST /ask returns validated SQL only.

Status: pre-1.0.

Install

pnpm add -g @askdb/http-api
askdb-http

Or run from a clone — see "Local run" below.

Local run

From repo root:

pnpm -C apps/http-api build
node apps/http-api/dist/bin.js

Dev watch (runs with apps/http-api as the working directory):

pnpm -C apps/http-api dev:watch

Set ASKDB_SCHEMA_PATH in the repo-root .env (recommended). The binary also loads askdb.config.* / .config/askdb.* from the current working directory via @askdb/config after resolving .env candidates (repo root, cwd, package dir).

# in ../../.env (repo root):
# ASKDB_SCHEMA_PATH=fixtures/schemas/orders-users.schema.json

Health check:

curl -sS http://127.0.0.1:3000/health

Ask (curl)

curl -sS http://127.0.0.1:3000/ask \
  -H 'content-type: application/json' \
  -H 'x-correlation-id: demo-123' \
  -d "$(cat <<'JSON'
{
  "question": "How many users are there?"
}
JSON
)"

Notes:

  • Correlation: if you omit x-correlation-id, the server generates one and returns it.
  • Mode: optional x-askdb-mode header (body mode wins if present).
  • Execution: not supported. Retired execution controls return 400; review generated SQL and run any approved query outside AskDB under your own database roles, read-only controls, tenant policy, and audit logging.
  • Generation config: set OPENAI_API_KEY (or for tests/dev, set ASKDB_MOCK_SQL to bypass live model calls).
  • Schema config (recommended): set ASKDB_SCHEMA_PATH to an AskDB Schema v2 directory, bundled JSON file, or schema.json. You can also send schemaJson per request as an override, but it doesn’t scale.

Ask (Node)

const res = await fetch("http://127.0.0.1:3000/ask", {
  method: "POST",
  headers: {
    "content-type": "application/json",
    "x-correlation-id": "demo-123",
    "x-askdb-mode": "schema_only",
  },
  body: JSON.stringify({
    question: "How many users are there?",
  }),
});

console.log(await res.json());

License

Apache-2.0 © Yahya Gilany. See LICENSE and NOTICE.