Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/yamalight/graffiti

Minimalistic GraphQL framework
https://github.com/yamalight/graffiti

framework graffiti graphql graphql-apis node toolbox tooling

Last synced: 6 days ago
JSON representation

Minimalistic GraphQL framework

Awesome Lists containing this project

README

        

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:

```js
// 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`:

```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](https://www.fastify.io/), [graphql-compose](https://graphql-compose.github.io/) and [Mongoose](https://mongoosejs.com/).
Graffiti is heavily inspired by awesome [Next.js](https://nextjs.org/) and is mostly there to remove the need to write boilerplate code yourself.

You can find detailed documentation in [`./docs` folder](./docs/README.md).

You can also find more examples in [`./examples` folder](./examples).

## Special thanks

A huge thank you to:

- [Jay Phelps](https://github.com/jayphelps) for releasing the "graffiti" npm package name to me!
- [Ivan Semenov](https://www.behance.net/ivan_semenov) for making [an awesome logo](./logo/README.md)