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

indxflow

v1.0.0

Published

Ultra-fast, zero-dependency Serverless PostgreSQL HTTP Client, Type-Safe ORM & CLI for Indxflow DBaaS

Readme

⚡ Indxflow — Zero-Dependency Serverless PostgreSQL HTTP Client & Type-Safe ORM

NPM Version Bundle Size TypeScript License: MIT

Official ultra-fast, zero-dependency Serverless PostgreSQL HTTP Client, Type-Safe ORM & CLI for Indxflow DBaaS — the low-cost Serverless PostgreSQL API Gateway with automatic Scale-to-Zero ($1.00 = 100,000 queries).


🌟 Why Indxflow?

  • 🪶 Zero Dependencies (< 5 KB): Built entirely on native fetch. Zero binary engines (no Prisma 30MB+ cold-starts).
  • ⚡ Sub-5ms Latency: Parameterized HTTP SQL over persistent connections. Completely eliminates TCP connection pool exhaustion in serverless edge runtimes (Next.js 15, Vercel Edge, Cloudflare Workers, AWS Lambda).
  • 🛡️ Type-Safe ORM & Query Builder: Fluent syntax (db.from('users').select(...).where(...).orderBy(...)) with complete TypeScript column inference.
  • 🏷️ Tagged Template Literals (sql): Safe parameter interpolation $1, $2... protecting against SQL injection vulnerabilities.
  • 💰 Scale-to-Zero & RFC 7807 Error Handling: Automatic parsing of token balances via X-Tokens-Remaining and typed PaymentRequiredError (HTTP 402) when balance hits zero.
  • 🤖 Autonomous AI Agent Onboarding: Instant database provisioning via Indxflow.provision() with 25,000 free starter tokens.
  • 🛠️ CLI Schema Codegen (npx indxflow pull): Instantly pull remote PostgreSQL schema and generate TypeScript type definitions.

📦 Installation

npm install indxflow
# or
pnpm add indxflow
# or
yarn add indxflow

🚀 1. Type-Safe ORM Usage

import { createOrm } from 'indxflow';

// 1. Define your database schema interface (or generate via `npx indxflow pull`)
interface AppSchema {
  users: {
    id: string;
    email: string;
    name: string;
    age: number;
    status: 'active' | 'banned';
    created_at: string;
  };
  posts: {
    id: string;
    user_id: string;
    title: string;
    views: number;
  };
}

// 2. Initialize ORM (reads INDXFLOW_API_KEY from environment)
export const db = createOrm<AppSchema>();

// 3. Type-Safe SELECT Query:
const activeUsers = await db.from('users')
  .select('id', 'email', 'name')
  .where('status', '=', 'active')
  .andWhere('age', '>=', 18)
  .orderBy('created_at', 'DESC')
  .limit(10)
  .execute();

console.log(activeUsers.rows); // Typed as Array<{ id: string; email: string; name: string }>
console.log(`Executed in ${activeUsers.latencyMs}ms. Tokens left: ${activeUsers.tokensRemaining}`);

// 4. Type-Safe INSERT with Returning:
const newUser = await db.into('users')
  .values({
    email: '[email protected]',
    name: 'Alex',
    age: 25,
    status: 'active',
  })
  .onConflictDoNothing()
  .returning('id', 'email')
  .executeTakeFirstOrThrow();

// 5. Type-Safe UPDATE:
await db.update('users')
  .set({ status: 'banned' })
  .where('id', '=', 'usr_123')
  .execute();

// 6. Type-Safe DELETE:
await db.deleteFrom('posts')
  .where('views', '<', 5)
  .execute();

⚡ 2. Tagged Template SQL (sql)

For raw queries with automated parameter extraction:

import { Indxflow, sql } from 'indxflow';

const client = new Indxflow();

const minAge = 21;
const city = 'London';

const result = await client.sql`
  SELECT id, name, email 
  FROM users 
  WHERE age >= ${minAge} AND city = ${city}
  LIMIT 20
`;

console.log(result.rows);

🔄 3. Atomic Transactions & Batching

Execute multiple operations in a single atomic HTTP round-trip:

const { result, totalLatencyMs } = await db.transaction(async (tx) => {
  tx.add(
    db.into('orders').values({ user_id: 'usr_1', amount: 150 })
  );
  tx.add(
    db.update('users').set({ status: 'active' }).where('id', '=', 'usr_1')
  );
});

console.log(`Transaction executed in ${totalLatencyMs}ms`);

🛠️ 4. Indxflow CLI

Generate TypeScript types directly from your active database:

# Pull schema and create src/types/db.d.ts
npx indxflow pull

# Inspect database latency, tokens and server health
npx indxflow status

🤖 5. Autonomous AI Agent Provisioning

import { Indxflow } from 'indxflow';

const provision = await Indxflow.provision({
  email: '[email protected]',
  db_name: 'my-agent-app',
  agent_name: 'Claude Code',
});

console.log(`API Key: ${provision.api_key}`);
console.log(`Claim in Web Dashboard: ${provision.claim_url}`);

🛡️ Error Handling & Scale-to-Zero

import { db, PaymentRequiredError, RateLimitError } from 'indxflow';

try {
  const users = await db.from('users').selectAll().execute();
} catch (error) {
  if (error instanceof PaymentRequiredError) {
    console.error('Scale-to-Zero: Database tokens exhausted. Top up at https://indxflow.com');
  } else if (error instanceof RateLimitError) {
    console.warn('Rate limit exceeded (100 RPS).');
  } else {
    console.error('Query error:', error);
  }
}

📄 License

MIT © Indxflow