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

@foxframework/db-mysql

v1.0.0

Published

MySQL provider for Fox Framework

Readme

@foxframework/db-mysql

MySQL / MariaDB provider for Fox Framework — connection pooling via mysql2, Repository pattern, and a fluent QueryBuilder.

Installation

npm install @foxframework/db-mysql mysql2

mysql2 is a peer dependency — you control which version of the driver you use.

Quick start

import { MySQLProvider } from '@foxframework/db-mysql';

const db = new MySQLProvider({
  host: 'localhost',
  port: 3306,
  database: 'mydb',
  user: 'admin',
  password: 'secret',
  pool: { min: 2, max: 10 },
});

await db.connect();

// --- Repository ---
interface User {
  id: number;
  name: string;
  email: string;
  active: boolean;
}

const users = db.repository<User>('users');

const alice   = await users.findById(1);
const active  = await users.findAll({ where: { active: true }, limit: 20 });
const bob     = await users.create({ name: 'Bob', email: '[email protected]', active: true });
const updated = await users.update(bob.id, { name: 'Robert' });
const deleted = await users.delete(bob.id);
const total   = await users.count({ where: { active: true } });

// --- QueryBuilder ---
const results = await db.queryBuilder<User>()
  .from('users')
  .select('id', 'name', 'email')
  .where('active', '=', true)
  .andWhere('name', 'LIKE', 'A%')
  .orderBy('name', 'ASC')
  .limit(10)
  .offset(0)
  .execute();

// --- Raw SQL ---
const raw = await db.raw<User>('SELECT * FROM users WHERE id = ?', [1]);

await db.disconnect();

API

MySQLProvider

| Method | Description | |---|---| | connect() | Creates the connection pool and validates connectivity | | disconnect() | Drains the pool | | raw<T>(sql, params?) | Executes a parameterised query, returns QueryResult<T> | | repository<T>(table) | Returns a MySQLRepository<T> for the given table | | queryBuilder<T>() | Returns a standalone MySQLQueryBuilder<T> | | isConnected | true after connect() succeeds |

IRepository<T> methods

| Method | Description | |---|---| | findById(id) | T \| null | | findOne(options) | First match or null | | findAll(options?) | All matching rows | | create(data) | INSERT … + re-select by insertId | | update(id, data) | UPDATE … + re-select by id | | delete(id) | true if a row was deleted | | count(options?) | Row count | | query() | QueryBuilder pre-seeded with this table |

IQueryBuilder<T> methods

from · select · where · andWhere · orWhere · orderBy · limit · offset · execute · toSQL

Supported operators: = != < <= > >= LIKE IN NOT IN

Uses ? placeholders and backtick-quoted identifiers (MySQL style).

Configuration

interface DbConfig {
  host: string;
  port: number;
  database: string;
  user: string;
  password: string;
  ssl?: boolean | object;
  pool?: {
    min?: number;                  // default: 2
    max?: number;                  // default: 10
    idleTimeoutMillis?: number;    // default: 30000
    acquireTimeoutMillis?: number; // default: 5000
  };
}

License

MIT