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 🙏

© 2025 – Pkg Stats / Ryan Hefner

fasty-orm

v0.0.6

Published

A blazing fast, type-safe ORM for Node.js and TypeScript, powered by a native Rust engine. Inspired by Drizzle ORM, with a focus on performance, safety, a fluent query builder API, and a powerful native query cache.

Readme

fasty-orm

A blazing fast, type-safe ORM for Node.js and TypeScript, powered by a native Rust engine. Inspired by Drizzle ORM, with a focus on performance, safety, a fluent query builder API, and a powerful native query cache.


Features

  • ⚡️ Native Rust backend for maximum performance (via N-API)
  • 🛡️ Type-safe schema and query builder (TypeScript-first)
  • 🧩 Drizzle-like fluent API for building SQL queries
  • 🔒 Prevents SQL injection with parameterized queries
  • 🗄️ Built-in native query caching (configurable TTL and capacity)
  • 🔁 Advanced join and transformation utilities
  • 🐬 MySQL support (other databases planned)
  • 🧪 Easy to test and extend

Architecture

TypeScript (Query Builder)
        ↓
Generates SQL string + params
        ↓
Native Rust addon (N-API)
        ↓
MySQL database

Installation

npm install fasty-orm
# or, if using your local build:
npm install ./fasty-orm-0.0.1.tgz

Note: Requires Node.js and a Rust toolchain for native builds.


Quick Start

import { FastyORM, table, eq } from 'fasty-orm';

// Define your schema
const users = table('users', {
  id: integer('id').primaryKey().autoIncrement(),
  name: text('name').notNull(),
  age: integer('age'),
});

// Connect to the database
const db = await FastyORM.connect('mysql://user:pass@localhost:3306/mydb');

// Enable and configure the native cache (optional but recommended)
FastyORM.initCache(1000, 5000); // 1000 entries, 5s default TTL

// Query data with cache
const result = await db.select().from(users).where(eq(users.id, 1)).cache({ ttl: 10000 });
// The above query will be cached natively for 10 seconds

// Insert data
await db.insert(users).values({ name: 'Alice', age: 30 });

// Update data
await db.update(users).set({ age: 31 }).where(eq(users.name, 'Alice'));

// Delete data
await db.delete(users).where(eq(users.id, 1));

Native Query Cache

  • Native cache is implemented in Rust for maximum speed.
  • You can globally initialize the cache:
    FastyORM.initCache(1000, 5000); // 1000 entries, 5s default TTL
  • Per-query cache TTL is supported:
    db.select().from(users).where(...).cache({ ttl: 10000 })
  • All cache logic is handled natively, so cache hits are extremely fast and do not hit the database.

Schema Definition

Define tables and columns in a type-safe way:

const users = table('users', {
  id: integer('id').primaryKey().autoIncrement(),
  name: text('name').notNull(),
  email: text('email').notNull(),
  created_at: datetime('created_at').default('CURRENT_TIMESTAMP'),
});
  • primaryKey(), notNull(), default(value), autoIncrement(), and foreignKey() are supported.
  • TypeScript infers types for selects and inserts.

Query Builder

Fluent, composable API for building SQL:

  • select().from(table).where(...)
  • insert(table).values({...})
  • update(table).set({...}).where(...)
  • delete(table).where(...)

All queries are parameterized to prevent SQL injection.


SQL Operators

Type-safe SQL operators for WHERE clauses:

  • eq(column, value) — equals
  • ne(column, value) — not equals
  • gt, lt, gte, lte — comparisons
  • and(...), or(...) — logical composition

Example:

where(and(eq(users.name, 'Alice'), gt(users.age, 18)))

Advanced Features

  • Join and Relationship Utilities: Built-in helpers for key mapping, relationship parsing, and result transformation, with internal caching for performance.
  • Raw Queries: Execute raw SQL with db.raw<T>(sql, params) and get typed results.
  • Type Inference: All builders and schema definitions are fully type-safe, with TypeScript inferring result and insert types.
  • Extensible: Utilities and types are exported for advanced usage and extension.

Native Engine

  • The Rust backend is loaded via N-API as a .node or .dylib file.
  • If the native module is missing, run:
    cargo build --release
    cp target/release/libfasty_orm.dylib fasty_orm.node
  • The engine exposes connection, query, cache, and version APIs.

Scripts

  • npm run build-native — Builds the Rust engine and copies the binary.
  • npm run build — Compiles TypeScript to dist/.
  • npm run prepublishOnly — Runs both before publishing.

Project Structure

  • src/ — TypeScript source (query builder, schema, operators, etc.)
  • fasty_orm.node — Native Rust engine (built artifact)
  • dist/ — Compiled JS output

Requirements

  • Node.js 16+
  • Rust toolchain (for native builds)
  • MySQL database

License

MIT


Contributing

PRs and issues are welcome! See the roadmap and docs for future plans.