Awesome Open Source
Awesome Open Source
Exoframe

Graffiti.js is a minimalistic GraphQL framework

How to use

Install it:

$ npm install graffiti --save

After that, the file-system is the main API. Every .js file becomes a schema definition that gets automatically processed and converted to GraphQL API.

Populate ./schema/note.js inside your project:

// export new Mongoose.js schema definition
exports.schema = {
  name: String,
  body: String,
  // NOTE: Mongoose model names will always be capitalized versions of your filenames
  group: { type: 'ObjectId', ref: 'Collection' },
};

and /schema/collection.js:

exports.schema = {
  name: String,
};

and then just run graffiti dev and go to http://localhost:3000/playground

So far, you get:

  • Automatic creation of GraphQL APIs
  • Automatic relations between types (when using ObjectId as type)
  • Access to GraphQL playground (in development mode)
  • Way to add manual resolvers or GraphQL methods
  • Way to setup manual complex relations
  • Automatic app reload on schema changes (in development mode)
  • Extensibility via third-party plugins

Requirements

Graffiti assumes you have:

  • MongoDB v4.0+ (easiest way is to start one using docker: docker run --name mongodb -p 27017:27017 -d mongo)
  • Node.js v14.8+

How it works

Graffiti.js is built on top of fastify, graphql-compose and Mongoose.
Graffiti is heavily inspired by awesome Next.js and is mostly there to remove the need to write boilerplate code yourself.

You can find detailed documentation in ./docs folder.

You can also find more examples in ./examples folder.

Special thanks

A huge thank you to:


Get A Weekly Email With Trending Projects For These Topics
No Spam. Unsubscribe easily at any time.
javascript (70,403
framework (1,117
graphql (1,076
node (1,001
toolbox (63
tooling (42