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

@titanpl/ragedb

v1.0.3

Published

High-Performance Database Extension for Titan Planet

Readme

RageDB - Titan ORM Extension

RageDB is the Most Secure & Fast Database Extension for TitanPl servers. It bridges the gap between Titan's synchronous runtime and asynchronous database drivers, providing a seamless "synchronous-like" developer experience using Titan's internal drift mechanism.

Features

  • Most Secure: Built-in parameterization and strict path validation for queries.
  • Fastest Performance: Leverages native Rust bindings and zero-cost abstractions.
  • Multi-Driver Support: Compatible with PostgreSQL, MySQL, SQLite, and MongoDB.
  • Titan-Native DX: Methods block the current fiber but not the server thread, enabling await-free syntax.
  • Type-Safe: Complete TypeScript definitions.
  • Scaffold Ready: Pre-configured structure for immediate use.

Installation

Ensure you have the Titan runtime installed. This extension is typically part of a Titan project workspace.

npm install @titanpl/ragedb

Quick Start

RageDB connects to your database and executes queries synchronously from your perspective, handling the async complexity internally.

1. Connecting to the Database

Initialize the connection at the start of your action or in a global initialization script.

import { rageDb } from "@titanpl/ragedb";

export default function (req) {
    // Establish connection (blocks fiber until connected)
    rageDb.connect({
        type: "postgres",
        url: process.env.DB_URI || "postgresql://user:pass@localhost:5432/db",
        poolSize: 10
    });
    
    t.log("Connected to database!");

    // Your app logic...
}

2. Executing Queries

Execute SQL queries directly. The result is returned as a plain JavaScript array (or object for single row logic if you implement it), ready to use.

/* eslint-disable no-undef */
// Simple Query
const users = rageDb.query("SELECT * FROM users LIMIT 5");
t.log("Users:", users); // [{ id: 1, name: "Alice" }, ...]

// Parameterized Query (prevents SQL injection)
const user = rageDb.query("SELECT * FROM users WHERE id = $1", [1]);

3. Running Query Files

Keep your code clean by storing complex SQL in .sql files.

// Executes content of /queries/get_active_users.sql
const activeUsers = rageDb.query("queries/get_active_users.sql");

How It Works (The "Magic")

You might wonder why you don't need await or drift() despite database operations being asynchronous.

RageDB uses Titan's Fiber System. When you call rageDb.query(...):

  1. The request is sent to the native Rust layer.
  2. The JS execution checks the task status.
  3. If pending, it calls drift({ type: 'sleep', ... }) internally.
  4. This suspends the current request fiber, allowing the Titan server to handle other requests.
  5. Once the database responds, the fiber resumes exactly where it left off.

This gives you the simplicity of synchronous code (PHP/Python style) with the performance of asynchronous Node.js.

Configuration

| Option | Type | Description | |--------|------|-------------| | type | string | Database type: postgres, mysql, sqlite, mongo | | url | string | Connection string URL | | poolSize | number | (Optional) Max connections in pool. Default: cpu * 2 | | ssl | boolean | (Optional) Enable SSL. Default: false | | logQueries | boolean | (Optional) Log all SQL to stdout. Default: false |

API Reference

rageDb.connect(config)

Initializes the global connection pool. Blocks until connection is established.

rageDb.query(sql, params?)

Executes a query and returns the rows/documents. Blocks until result is ready.

  • Returns: Array<any> (default)

rageDb.collection(name)

Returns a MongoDB-style collection helper for find, insert, update, delete.