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

@shadow-dev/orm

v2.0.4

Published

Lightweight dynamic MySQL ORM designed for ShadowCore and modular apps.

Readme

ShadowORM

🧩 Lightweight, type-safe MySQL ORM for ShadowCore projects.
ShadowORM is built for modularity, control, and runtime schema management — ideal for bots, services, and web apps.

npm version license


📘 Overview

ShadowORM is a minimalist ORM focused on explicit schemas and runtime safety — without decorators, reflection, or heavy abstractions.

Key Features

  • Type-safe models using generics
  • Runtime schema sync (lightweight migrations)
  • Rich field types (text, numeric, binary, datetime, JSON, UUID)
  • Indexes & unique constraints
  • Foreign key relationships with cascade rules
  • JSON + Date normalization
  • No decorators, no reflection, no magic

It integrates cleanly with ShadowCore, but works standalone in any Node.js + TypeScript project.


📦 Installation

npm install @shadow-dev/orm mysql2

🧠 Usage Example

import {
  Model,
  Repository,
  initDatabase,
  registerModel,
  syncSchema
} from "@shadow-dev/orm";

const Ticket = new Model<{
  id: string;
  type: "support" | "report";
  data: { message: string };
  createdAt: Date;
}>("tickets", {
  id: { type: "uuid", pk: true },
  type: { type: "string", required: true },
  data: { type: "json" },
  createdAt: { type: "datetime", default: () => new Date() }
});

initDatabase({
  host: "localhost",
  user: "root",
  password: "password",
  database: "mydb"
});

registerModel(Ticket);

// Applies schema changes (tables, columns, indexes, FKs)
await syncSchema();

const tickets = new Repository(Ticket);

await tickets.create({
  id: crypto.randomUUID(),
  type: "support",
  data: { message: "Help me!" },
  createdAt: new Date()
});

🧱 Schema System

Field Types

ShadowORM supports a wide range of SQL types:

| Category | Types | |------------|------| | Strings | string, text, mediumtext, longtext | | Numbers | int, bigint, float, double, decimal | | Boolean | boolean | | Dates | date, time, datetime, timestamp | | JSON | json | | Binary | binary, varbinary | | Misc | uuid |


Field Options

{
  type: "string",
  pk?: boolean,
  autoIncrement?: boolean,
  required?: boolean,
  unique?: boolean,
  default?: any
}

Indexes

indexes: [
  {
    columns: ["email"],
    unique: true
  },
  {
    columns: ["userId", "createdAt"]
  }
]

Foreign Keys

foreignKeys: [
  {
    column: "userId",
    references: {
      table: "users",
      column: "id"
    },
    onDelete: "CASCADE",
    onUpdate: "CASCADE"
  }
]

🔄 Schema Sync (Lightweight Migrations)

ShadowORM includes a runtime schema sync system that:

  • Creates missing tables
  • Adds new columns
  • Applies indexes
  • Applies foreign keys

This acts as a lightweight migration system — without requiring migration files or CLI tooling.

⚠️ Destructive changes (like dropping columns) are intentionally not automatic.


🛣 Roadmap

  • [x] CRUD repository
  • [x] Relational schema support
  • [x] Runtime schema sync (light migrations)
  • [x] Index support
  • [x] Foreign key constraints
  • [ ] CLI (optional)
  • [ ] Full migration system (optional)
  • [ ] PostgreSQL support (planned)

📚 Documentation

📖 Docs coming soon:
➡️ https://docs.shadowdevelopment.net


🏢 Project Ownership

ShadowORM is developed and maintained under Shadow Development LLC.
➡️ https://shadowdevelopment.net


📄 License

Licensed under the GNU General Public License v3.0
See the LICENSE file for details.