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 🙏

© 2024 – Pkg Stats / Ryan Hefner

ruru

v2.0.0-beta.11

Published

Grafast-flavoured GraphiQL distribution

Downloads

15,815

Readme

ruru

A Grafast-enhanced distribution of GraphiQL.

PRERELEASE: this is pre-release software; use at your own risk and do not embed into public-facing projects. This will likely change a lot before it's ultimately released. The pre-release nature also explains the shocking lack of documentation.

Usage - Instant!

If you have Node installed, you can instantly run ruru without permanently installing it using the npx command. Here's an example command to explore @trevorblades's countries API:

npx ruru@beta -SPe https://countries.trevorblades.com/graphql

(-S enables subscriptions, -P proxies GraphQL requests; neither of these are needed for Trevor's API, but you might want them for your API.)

Usage - CLI

Install Ruru:

yarn add ruru@beta

Then you can run something like the following to automatically proxy requests (bypassing CORS issues):

yarn ruru -SPe http://localhost:5678/graphql

Usage:

ruru

Run a Ruru server

Options:
      --help                   Show help                                                                      [boolean]
      --version                Show version number                                                            [boolean]
  -e, --endpoint               endpoint for query and mutation operations
                                                                    [string] [default: "http://localhost:5678/graphql"]
  -p, --port                   port number to run the server on                                [number] [default: 1337]
  -P, --proxy                  Proxy requests to work around CORS issues                                      [boolean]
  -S, --subscriptions          enable subscriptions, converting --endpoint to a ws:// URL    [boolean] [default: false]
  -s, --subscription-endpoint  endpoint for subscription operations (overrides -S)                             [string]

Usage - bundle

<!-- optionally import Prettier for query formatting -->
<script src="https://unpkg.com/[email protected]/standalone.js"></script>
<script src="https://unpkg.com/[email protected]/parser-graphql.js"></script>
<!-- Required below here -->
<div id="ruru-root"></div>
<link href="https://unpkg.com/graphiql/graphiql.min.css" rel="stylesheet" />
<script crossorigin src="https://unpkg.com/ruru/bundle/ruru.min.js"></script>
<script>
  const { React, createRoot, Ruru } = RuruBundle;
  const tree = React.createElement(Ruru, {
    endpoint: "/graphql",
  });
  const container = document.getElementById("ruru-root");
  const root = createRoot(container);
  root.render(tree);
</script>

Usage - library

import { Ruru } from "ruru-components";
import "graphiql/graphiql.css";
import "@graphiql/plugin-explorer/dist/style.css";
import "ruru-components/ruru.css";

React.render(<Ruru endpoint="/graphql" />);

Usage - middleware

import { ruruHTML } from "ruru/server";

// ...

app.get("/", (req, res, next) => {
  res.writeHead(200, { "Content-Type": "text/html" });
  return res.end(
    ruruHTML({
      endpoint: "/graphql",
    }),
  );
});

Why "ruru"?

Jem and I are big fans of the late Terry Pratchett's Discworld universe. The city at the centre of many a Discworld tale is the twin-city city-state of Ankh-Morpork. A "morepork" is a type of New Zealand owl, known in Māori as "ruru." Owls have excellent sight, and Ruru helps you to get an insight into not just the inputs and outputs of your API, but also what it does internally.

RURU is also an abbreviation for checks to use when gathering information: "is it Reliable, Up-to-date, Relevant, and Useful?" We hope that you'll find Ruru to be all those things!

... in the Quechua languages, the term "ruru" may refer to, among other things, "testicle." So when your GraphQL operation isn't doing what you expect and you're thinking to yourself "this is b*ll*cks," then you'll know this is a job for Ruru!

GNU Terry Pratchett