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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@giraphql/deno

v2.20.0

Published

Deno compatible versions of GiraphQL packages

Downloads

53

Readme

GiraphQL - A plugin based GraphQL schema builder for typescript

GiraphQL makes writing graphql schemas in typescript easy, fast and enjoyable. The core of GiraphQL adds 0 overhead at runtime, and has graphql as its only dependency.

By leaning heavily on typescripts ability to infer types, GiraphQL is the most type-safe way of writing GraphQL schemas in typescript/node while requiring very few manual type definitions and no code generation.

GiraphQL has a unique and powerful plugin system that makes every plugin feel like its features are built into the core library. Plugins can extend almost any part of the API by adding new options or methods that can take full advantage of GiraphQLs type system.

Hello, World

import { ApolloServer } from 'apollo-server';
import SchemaBuilder from '@giraphql/core';

const builder = new SchemaBuilder({});

builder.queryType({
  fields: (t) => ({
    hello: t.string({
      args: {
        name: t.arg.string({}),
      },
      resolve: (parent, { name }) => `hello, ${name || 'World'}`,
    }),
  }),
});

new ApolloServer({
  schema: builder.toSchema({}),
}).listen(3000);

Plugins that make GiraphQL even better

  • Scope Auth

    Add global, type level, or field level authorization checks to your schema
  • Validation

    Validating your inputs and arguments
  • Dataloader

    Quickly define data-loaders for your types and fields to avoid n+1 queries.
  • Relay

  • Easy to use builder methods for defining relay style nodes and connections, and helpful utilities for cursor based pagination.
  • Simple Objects

    Define simple object types without resolvers or manual type definitions.
  • Mocks

    Add mock resolver for easier testing
  • Sub-Graph

    Build multiple subsets of your graph to easily share code between internal and external APIs.
  • Directives

    Integrate with existing schema graphql directives in a type-safe way.
  • Smart Subscriptions

    Make any part of your graph subscribable to get live updates as your data changes.

Setup

Imports

Most of the setup for deno works exactly the same way as it does for node. The main difference is where things are imported from. GiraphQL and all its plugins are published as a single package on deno.land. Each of the node packages available on npm are available in the packages directory:

// Core
import SchemaBuilder from 'https://deno.land/x/giraphql/packages/core/mod.ts';
// Plugins:
import ValidationPlugin from 'https://deno.land/x/giraphql/packages/plugin-validation/mod.ts';
import ScopeAuthPlugin from 'https://deno.land/x/giraphql/packages/plugin-scope-auth/mod.ts';
// ...etc

Server

Most of the docs and examples currently use apollo-server, because it is the simplest to set up for node. Unfortunately apollo-server does not work in deno. Instead we can use GraphQL Helix:

import { Application, Router } from 'https://deno.land/x/[email protected]/mod.ts';
// Currently the way helix exports graphiql doesn't work in deno, so we import the other parts directly, and import a very simple playground file from a gist.
import { shouldRenderGraphiQL } from 'https://cdn.jsdelivr.net/gh/contrawork/graphql-helix@master/packages/deno/should-render-graphiql.ts';
import { processRequest } from 'https://cdn.jsdelivr.net/gh/contrawork/graphql-helix@master/packages/deno/process-request.ts';
import { getGraphQLParameters } from 'https://cdn.jsdelivr.net/gh/contrawork/graphql-helix@master/packages/deno/get-graphql-parameters.ts';
import playground from 'https://gist.githubusercontent.com/hayes/5c99f7b4f71234452036fd88e142a825/raw/655245a052b10c2912a803c8a6d537096b73c10b/playground.ts';
// GiraphQL
import SchemaBuilder from 'https://deno.land/x/giraphql/packages/core/mod.ts';

// Create app and router
const app = new Application();
const router = new Router();

// Create a very simple schema
const builder = new SchemaBuilder({});

builder.queryType({
  fields: (t) => ({
    hello: t.string({
      args: {
        name: t.arg.string({}),
      },
      resolve: (parent, { name }) => `hello, ${name || 'World'}`,
    }),
  }),
});

const schema = builder.toSchema({});

// Mount a route to serve the graphql API and playground
router.all('/graphql', async (context) => {
  // parse request
  const request = {
    body: await context.request.body({}).value,
    headers: context.request.headers,
    method: context.request.method,
    query: context.request.url.searchParams,
  };

  if (shouldRenderGraphiQL(request)) {
    context.response.body = playground({ endpoint: 'localhost:8080/graphql' });

    return;
  }
  // Extract the GraphQL parameters from the request
  const { operationName, query, variables } = getGraphQLParameters(request);

  // Validate and execute the query
  const result = await processRequest({
    operationName,
    query,
    variables,
    request,
    schema,
  });

  if (result.type === 'RESPONSE') {
    // We set the provided status and headers and just the send the payload back to the client
    result.headers.forEach(({ name, value }) => context.response.headers.set(name, value));

    context.response.status = result.status;
    context.response.body = result.payload;
  } else {
    // Omitting other response types for brevity, see graphql-helix docs for more a complete implementation
    throw new Error('Unsupported result type');
  }
});

app.use(router.routes());
app.use(router.allowedMethods());

console.log('Go to http://localhost:8080/graphql to open the playground');
await app.listen({ port: 8080 });

GraphQL versions

The graphql library is written in a way that make tools that import different copies of graphql incompatible. This means that we need a way to ensure that our graphql library versions are the same across our dependencies. There isn't a perfect solution right now, but import-maps give us something that works.

GiraphQL uses https://cdn.skypack.dev/graphql?dts to make it easy to replace with an import map. GraphQL Helix currently uses https://cdn.skypack.dev/[email protected]?dts

To get these 2 libraries to work together, we can define an import map like:

{
  "imports": {
    "https://cdn.skypack.dev/[email protected]?dts": "https://cdn.skypack.dev/[email protected]?dts",
    "https://cdn.skypack.dev/graphql?dts": "https://cdn.skypack.dev/[email protected]?dts"
  }
}

This will let us run our app with both libraries using https://cdn.skypack.dev/[email protected]?dts (or any other version you want to use). It will be important to keep the versions in sync if you update your dependencies.

Running the app:

deno run --allow-net --import-map=import-map.json server-example.ts

Full docs available at https://giraphql.com/