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

@7y1o/qreactor

v1.1.5

Published

GraphQL router based on Express

Downloads

8

Readme

QReactor

GraphQL server built on top of ExpressJS with support for Cookies, CORS and other useful stuff

Common job

What is QReactor?

QReactor is a library that combines the capabilities of ExpressJS and GraphQL. With the help of decorators, you can configure separate Express controllers and separate ones for GraphQL.

Cookies and CORS are already included in the "configuration" of the server. You can also add your middleware using the use method, as in Express.

How to start?

GraphQL example

Here is an example of how to run a small server with GraphQL:

# user.gql

type Query {
    searchUser(name: String!): UserSearchResponse!
}

type User {
    id: ID!,
    name: String!,
    online: Boolean!
}

type UserSearchResponse {
    result: User,
    error: String
}
// controller.ts (for example)
import { QLController, QLResolve } from '@7y1o/qreactor';

// Creating a new class with resolvers:

@QLController('src/schemas/user.gql', { path: '/api/user' })
class UserController {

    @QLResolve
    searchUser({name}, {req}) {
        if (!req.cookies['x-access-token']) return {
            error: 'err_no_token'
        };

        // ... some search ...

        return { user };
    }
}
export default UserController;
// main.ts
import QReactor from '@7y1o/qreactor';
import UserController from './controller';

const server = new QReactor({
    port: 7910
});

// Now we need to register our controller
server.ql(UserController);  // In this method, you can specify 
                            //multiple controllers separated by commas

server.start();

Basic Express example

// controller.ts
import {Controller, Get, Post} from '@7y1o/qreactor';

@Controller('/hello') // you can leave empty brackets here
class GreetsController {

    @Get('/')
    basicGreets(_, res) {
        return res.send('<h1>Hello! Glad to see you!</h1>');
    }

    @Post('/:name')
    sendGreets(req, res) {
        return res.send(`<h1>Hello, ${req.params.name}! Glad to see you!</h1>`);
    }
}
export default GreetsController;
// main.ts
import QReactor from '@7y1o/qreactor';
import GreetsController from './controller';

const server = new QReactor({
    cors: {
        origin: '*'
    }
});

server.express(GreetsController);
server.start();

Middleware example

// controller.ts
import {Controller, Post, Middleware} from '@7y1o/qreactor';

const testMiddle = (req, res, next) => {
    res.send('sent from middleware');
    next();
}

@Controller()
class IdentityController {

    // IMPORTANT! Write @Middleware over method decorator
    @Middleware(testMiddle)
    @Post('/signin')
    signIn(req, res) {
        req.session.name = req.body.name;
        req.session.save(() => res.send('Hello, ' + req.session.name)); 
    }

}

export default IdentityController;
// main.ts
import QReactor from '@7y1o/qreactor';
import IdentityController from './controller';

const server = new QReactor({
    session: {
        secret: 'verysecretcode',
        name: 'access-token'
    }
});

server.express(IdentityController);
server.start();

TODO:

New features:

  • [ ] — Add @Middleware decorator for using middlewares
  • [ ] — Add databases support
  • [ ] — Add GraphQL schema generator with decorators
  • [ ] — Add async preinitialize function for other libraries preparation (like mongoose or sqlite)
  • [ ] — Add log for debug and errors
  • [ ] — Make more strong types support
  • [ ] — Add request fields validator

Bugfixes and similar things:

  • [ ] — Optimize methods
  • [ ] — Add more tests for better library stability
  • [ ] — Fix the types of the GraphiQL field (in @QLController) for its correct operation
  • [ ] — Fix some bugs with queries and mutations

Other:

nothing is here

Ready:

  • [x] — Express server
  • [x] — Express controllers
  • [x] — GralhQL controllers
  • [x] — Middleware decorator for express controller

Full change log you can see on this page