Start using GraphQL with Graffiti

RisingStack's services:


Node.js Experts

Learn more at

Sign up to our newsletter!

In this article:

Update: we’ve released a Mongoose adapter for GraffitiHere’s how to get started with it.

Currently, the consumption of HTTP REST APIs dominate the client-side world and GraphQL aims to change that. The transition can be time-consuming – this is where Graffiti comes into the picture.

Graffiti grabs your existing models, transforms them into a GraphQL schema and exposes it over HTTP.

Check it out:

Why we made Graffiti for GraphQL

We don’t want to rewrite our application – no one wants that. Graffiti provides an express middleware, a hapi plugin and a koa middleware to convert your existing models into a GraphQL schema and exposes it over HTTP.

Use cases of Graffiti

There are a couple of areas where Graffiti is extremely useful:

For existing applications

If you are already running an HTTP REST API and uses an ORM then with adding a couple of lines of code you can expose a GraphQL endpoint.

For new applications

Graffiti comes to the rescue when you just about to start developing a new backend for your endpoint consumers – the only thing you have to define is your models using one of the supported ORMs.

Setup Graffiti

Adding to Graffiti to your project is as easy as:

import express from 'express';
import graffiti from '@risingstack/graffiti';
import {getSchema} from '@risingstack/graffiti-mongoose';
import mongooseSchema from './schema';

const app = express();
  schema: getSchema(mongooseSchema)

For complete, working examples check out our Graffiti examples folder.

You can play with a running Relay application using Graffiti. Navigate to to explore the schema with GraphiQL.

You can use a GraphQL schema generated by an adapter or your own GraphQLSchema instance with Graffiti.

GraphQL over Websocket / mqtt

With Graffiti you are not limited to HTTP – with the adapters you can easily expose the GraphQL interface over any transport protocol.


We have a fully functional Graffiti adapter for Mongoose and we have plans to support other ORMs too. Also, please note, that some of the following items depend only on the adapters, and not on the main project itself.

  • Query support (done)
  • Mutation support (done)
  • Yeoman generator (planned)
  • Relay support (done)
  • Adapters
    • for MongoDB: graffiti-mongoose (done)
    • for RethinkDB: graffiti-thinky (in progress)
    • for SQL: graffiti-bookshelf (in progress)


If you are interested in contributing, just say hi in the main Graffiti repository.

Share this post



Learn more at

Node.js Experts