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

@objectql/server

v4.0.3

Published

HTTP server adapter for ObjectQL - Express/NestJS compatible with GraphQL and REST API support

Readme

@objectql/server

Generic HTTP Server Adapter for ObjectQL. Allows running ObjectQL on Node.js, Express, Next.js, etc.

Installation

pnpm add @objectql/server

Usage

Node.js (Raw HTTP)

import { createNodeHandler } from '@objectql/server';
import { app } from './objectql'; // Your initialized ObjectQL instance
import { createServer } from 'http';

const handler = createNodeHandler(app);
const server = createServer(handler);
server.listen(3000);

Express

import express from 'express';
import { createNodeHandler } from '@objectql/server';
import { app } from './objectql';

const server = express();

// Optional: Mount express.json() if you want, but ObjectQL handles parsing too.
// server.use(express.json());

// Mount the handler
server.all('/api/objectql', createNodeHandler(app));

server.listen(3000);

Next.js (API Routes)

// pages/api/objectql.ts
import { createNodeHandler } from '@objectql/server';
import { app } from '../../lib/objectql';

export const config = {
  api: {
    bodyParser: false, // ObjectQL handles body parsing
  },
};

export default createNodeHandler(app);

API Response Format

ObjectQL uses a standardized response format for all operations:

List Operations (find)

List operations return data in an items array with optional pagination metadata:

{
  "items": [
    {
      "id": "1001",
      "name": "Contract A",
      "amount": 5000
    },
    {
      "id": "1002",
      "name": "Contract B",
      "amount": 3000
    }
  ],
  "meta": {
    "total": 105,       // Total number of records
    "page": 1,          // Current page number (1-indexed)
    "size": 20,         // Number of items per page
    "pages": 6,         // Total number of pages
    "has_next": true    // Whether there is a next page
  }
}

Note: The meta object is only included when pagination parameters (limit and/or skip) are used.

Single Item Operations (findOne, create, update, delete)

Single item operations return data in a data field with an @type identifier:

{
  "data": {
    "_id": "1001",
    "name": "Contract A",
    "amount": 5000,
    "@type": "contract"
  }
}

Note: The @type field indicates the object type, and _id is the unique identifier.

Error Responses

All errors follow a consistent format:

{
  "error": {
    "code": "NOT_FOUND",
    "message": "Record not found",
    "details": {
      "field": "id",
      "reason": "No record found with the given ID"
    }
  }
}

REST API Endpoints

The server exposes the following REST endpoints:

  • GET /api/data/:object - List records (supports ?limit=10&skip=0 for pagination)
  • GET /api/data/:object/:id - Get single record
  • POST /api/data/:object - Create record
  • PUT /api/data/:object/:id - Update record
  • DELETE /api/data/:object/:id - Delete record

Pagination Example

# Get first page (10 items)
GET /api/data/contracts?limit=10&skip=0

# Get second page (10 items)
GET /api/data/contracts?limit=10&skip=10

Metadata API Endpoints

  • GET /api/metadata/object - List all objects
  • GET /api/metadata/object/:name - Get object definition
  • GET /api/metadata/object/:name/actions - List object actions

All metadata list endpoints return data in the standardized items format.