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

fluxorm

v1.0.4

Published

FluxORM is a javascript-based ORM system built on Laravel.

Readme

npm version npm downloads license node


📢 Latest changes (v1.0.4 – 2025-12-05)

  • Fixed database connection import: replaced destructuring { db } with connection.get() to prevent undefined errors in Model and Validator
  • Stabilized User.save() and DB‑aware validation rules (unique, exists) by correctly accessing the pool
  • Added Model.insert(data) static shortcut for creating and saving new records
  • Added Model.create(data) alias for insert(), providing Laravel‑style API convenience

⚡ FluxORM

A powerful modular Node.js backend framework — ORM + Query Builder + Router + Kernel + Validator + Express API server.

FluxORM = Laravel feeling + Express speed + ultra-clean architecture.


🚀 Features

🔹 ORM + Query Builder

  • Model based ORM
  • Eager loading: with(), nested: posts.comments
  • Relációk:
    • hasOne
    • hasMany
    • belongsTo
    • belongsToMany
  • Query Builder functions:
    • where, orWhere, whereIn, whereNull, whereBetween
    • orderBy, limit, offset
    • raw, whereRaw, joinRaw, havingRaw
  • Model opcions:
    • save()
    • delete()
    • find()
    • first()

🔹 Router – Laravel style

  • router.get(), post(), put(), delete()
  • router.controller("users", Controller)
  • Route group prefix + middleware:
router.group({ prefix: "admin", middleware: ["token"] }, r => {
    r.controller("users", UserController);
});

🔹 Middleware Kernel

Glabol middleware management:

app/Kernel.js
const cors = require("../middleware/cors");

class Kernel {
    static middleware() {
        return [
            cors
        ];
    }
}

module.exports = Kernel;

🔹 Auth Middleware

Token or Cookie based authentication:

  • auth.token → Bearer token
  • auth.cookie → Cookie token
router.group({ prefix: "admin", middleware: ["token"] }, r => {
    r.get("/me", (req, res) => res.json(req.user));
});

🔹 Validator – Laravel-style

Supported rules:

  • required
  • email
  • min, max
  • integer, boolean
  • confirmed
  • unique:users,email
  • exists:roles,id
  • date, before, after

Use:

await Validator.validate(req.body, {
    email: "required|email|unique:users,email",
    password: "required|min:6|confirmed",
});

🔹 CLI Commands

orm init                 # projekt skeleton
orm serve                # API run
orm serve --dev          # nodemon dev mode
orm make:model User
orm make:controller UserController
orm make:migration create_users_table
orm make:seed UserSeed
orm migrate
orm migrate:rollback
orm seed

📁 Project Structure

/project
│
├── app/
│   └── Kernel.js
│
├── models/
├── controllers/
├── routes/
│   └── api.js
│
├── middleware/
│   ├── cors.js
│   └── auth.js
│
├── migrations/
├── seeders/
├── orm/
│   └── config.js
│
├── index.js
└── .env

🛠 Examples

1️⃣ Model

const { Model } = require("querybuilder");

class User extends Model {
    static get table() { return "users"; }

    posts() {
        return this.hasMany(Post, "user_id");
    }
}

module.exports = User;

2️⃣ Controller

const User = require("../models/User");

class UserController {
    static async index(req, res) {
        const users = await User.with("posts").get();
        res.json(users);
    }

    static async show(req, res) {
        const user = await User.find(req.params.id);
        if (!user) return res.status(404).json({ message: "Not found" });
        res.json(user);
    }
}

module.exports = UserController;

3️⃣ Routes

const { Router } = require("querybuilder");
const UserController = require("../controllers/UserController");

const router = new Router();

router.controller("users", UserController);

router.group({ prefix: "admin", middleware: ["token"] }, r => {
    r.controller("users", UserController);
});

router.get("/", (req, res) => res.json({ api: "FluxORM running 🚀" }));

module.exports = router.build();

4️⃣ Migrations

module.exports = {
  up: async (db) => {
    await db.schema.createTable("users", table => {
      table.increments("id");
      table.string("name").notNullable().build();
      table.boolean("active").defaultTo(true);
      table.timestamp("created_at").defaultTo(db.fn.now());
    });
  },

  down: async (db) => {
    await db.schema.dropTableIfExists("users");
  }
};

🚀 Start API

orm serve

In dev mode:

orm serve --dev

⚙️ .env

DB_HOST=localhost
DB_USER=root
DB_PASS=
DB_NAME=test
PORT=3000

📦 Migrations

orm make:migration create_users_table
orm migrate

🌱 Seeding

orm make:seed UserSeed
orm seed

❤️ Made by Janó

FluxORM official framework.