New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

bunerly

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bunerly

A typesafe and lightweight database query builder for Bun, inspired by Knex.js

latest
npmnpm
Version
0.0.1-dev.5
Version published
Weekly downloads
7
-12.5%
Maintainers
1
Weekly downloads
 
Created
Source

Bunerly

A typesafe and lightweight database query builder for Bun, inspired by Knex.js but built from the ground up with TypeScript and Bun's native performance in mind.

Features

  • 🚀 Built for Bun - Leverages Bun's native speed and TypeScript support
  • 🔒 Fully Typesafe - Complete TypeScript support with intelligent autocomplete
  • 📦 Zero Dependencies - No external dependencies, pure Bun implementation
  • 🎯 Knex-like API - Familiar syntax for easy migration from Knex
  • High Performance - Optimized for Bun's JavaScript engine
  • 🛠️ Database Agnostic - Support for SQLite, PostgreSQL, MySQL, and more

Installation

bun add bunerly

Quick Start

import { Bunerly } from 'bunerly';

// Initialize with your database configuration
const db = new Bunerly({
  client: 'sqlite3',
  connection: {
    filename: './database.sqlite'
  }
});

// Query with full type safety
const users = await db('users')
  .select('id', 'name', 'email')
  .where('active', true)
  .orderBy('created_at', 'desc')
  .limit(10);

// TypeScript knows the exact shape of your data
console.log(users[0].name); // ✅ Fully typed

API Reference

Query Building

// Select queries
const users = await db('users')
  .select('*')
  .where('age', '>', 18)
  .whereIn('status', ['active', 'pending'])
  .orderBy('name', 'asc')
  .limit(10);

// Joins
const posts = await db('posts')
  .select('posts.*', 'users.name as author_name')
  .join('users', 'posts.user_id', 'users.id')
  .where('posts.published', true);

// Aggregations
const stats = await db('orders')
  .select('status')
  .count('* as count')
  .sum('amount as total')
  .groupBy('status');

Insert/Update/Delete

// Insert
const [newUser] = await db('users')
  .insert({
    name: 'John Doe',
    email: 'john@example.com',
    created_at: new Date()
  })
  .returning('*');

// Update
const updated = await db('users')
  .where('id', 1)
  .update({
    name: 'Jane Doe',
    updated_at: new Date()
  })
  .returning('*');

// Delete
const deleted = await db('users')
  .where('id', 1)
  .del();

Transactions

await db.transaction(async (trx) => {
  await trx('users').insert({ name: 'User 1' });
  await trx('profiles').insert({ user_id: 1, bio: 'Bio' });
  // Transaction automatically commits if no errors
});

Database Support

  • SQLite - Built-in support via Bun's native SQLite
  • PostgreSQL - Via Bun's native PostgreSQL driver
  • MySQL - Via Bun's native MySQL driver
  • 🔄 More coming soon...

Migration from Knex

Bunerly maintains a Knex-compatible API, making migration straightforward:

// Before (Knex)
import knex from 'knex';
const db = knex({ client: 'sqlite3', connection: { filename: './db.sqlite' } });

// After (Bunerly)
import { Bunerly } from 'bunerly';
const db = new Bunerly({ client: 'sqlite3', connection: { filename: './db.sqlite' } });

Why Bunerly?

  • Performance: Built specifically for Bun's optimized JavaScript engine
  • Type Safety: Full TypeScript support with compile-time query validation
  • Simplicity: No complex abstractions, just clean, predictable APIs
  • Modern: Designed for modern JavaScript/TypeScript development
  • Lightweight: Minimal bundle size with zero dependencies

Contributing

We welcome contributions! Please see our Contributing Guide for details.

License

MIT License - see LICENSE for details.

Built with ❤️ for the Bun ecosystem

Keywords

bun

FAQs

Package last updated on 18 Sep 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts