Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/yamalight/graffiti
- Owner: yamalight
- License: mit
- Created: 2020-08-25T18:04:14.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-10-06T13:12:41.000Z (over 4 years ago)
- Last Synced: 2025-01-05T22:46:59.832Z (16 days ago)
- Topics: framework, graffiti, graphql, graphql-apis, node, toolbox, tooling
- Language: JavaScript
- Homepage:
- Size: 1.27 MB
- Stars: 304
- Watchers: 2
- Forks: 4
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Contributing: docs/Contributing.md
- License: LICENSE
Awesome Lists containing this project
README
> 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)