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

lightquery-orm

v1.0.5

Published

Direct client-side query for TypeORM databases

Downloads

12

Readme

LightQuery

World's first library that allows client side database query without writing back-end resolvers. This library works on top of the typed repositories from TypeORM. It's developed by SchoolNet. For security concerns read here.

Features

Write query from the client side using nothing but a simple JSON syntax.

  • Select
  • Where
    • like statement
    • limit

Example syntax on the client side:

let body = {
    word: {
        select: ["Word", "Type"],
        where: { ID: 3 }
    },
    generated_word: {
        select: ["Word"]
    }
}

This is an example JSON syntax for the body of the request to Light. "word" is the name of the repository in the switch function (see below). select is required, while where is not.

Usage

Import in Typescript:

import { light } from "lightquery-orm";

Switch function

The switch function is the only function that you need to implement in your backend in order to tell LightQuery which repositories can be accessed directly from the client side.

let switchCallback = (key) => {
    let repository: any;
    let failed: boolean;

    switch(key.toLowerCase()) {
        case "word": // this is the name of the repository
            repository = Words; // you give access to this repository
            break;
        case "generated_word":
            repository = WordGenerated;
            break;
        case "word_of_the_day":
            repository = WordDay;
            break;
        default:
            // you set failed to true
            // when the key doesn't match a repository
            failed = true;
            break;
    }

    return {
        repository,
        failed
    }
}

Implementation

If you want to see real-world implementation of this library, check out the ZBORAPI.ts file.

Details

Like statement

If you want to introduce a like statement in any query you would do it like this.

let body = {
    word: {
        select: ["Word", "Type"],
        where: { Word: "%thing%" }
    }
}

Limit

For limiting the number of queries you insert a limit variable in the where clause.

let body = {
    word: {
        select: ["Word", "Type"],
        where: { Word: "something", limit: 3 }
    }
}

Security

This library sits on top of TypeORM, so the only repositories it has contact with are these you give access to with the switch function. The only thing that the client can do right now, is to SELECT rows from specific tables. It is not possible to INSERT, UPDATE or DELETE anything in any of the tables.

In conclusion: you have nothing to worry about.

Contribute

Everyone is welcomed with their knowledge and time to contribute to this remarkable library.

Future

We are looking to make it available for MySQL without the need of TypeORM.