{"id":13454266,"url":"https://github.com/RisingStack/graffiti","last_synced_at":"2025-03-24T05:33:25.230Z","repository":{"id":35413274,"uuid":"39678043","full_name":"RisingStack/graffiti","owner":"RisingStack","description":"⚠️ DEVELOPMENT DISCONTINUED - Node.js GraphQL ORM","archived":false,"fork":false,"pushed_at":"2017-05-12T18:19:54.000Z","size":89,"stargazers_count":1006,"open_issues_count":7,"forks_count":44,"subscribers_count":37,"default_branch":"master","last_synced_at":"2025-03-19T10:42:01.994Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://risingstack-graffiti.signup.team/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/RisingStack.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-07-25T08:34:28.000Z","updated_at":"2024-12-27T00:46:09.000Z","dependencies_parsed_at":"2022-09-15T14:51:35.445Z","dependency_job_id":null,"html_url":"https://github.com/RisingStack/graffiti","commit_stats":null,"previous_names":[],"tags_count":18,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RisingStack%2Fgraffiti","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RisingStack%2Fgraffiti/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RisingStack%2Fgraffiti/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RisingStack%2Fgraffiti/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RisingStack","download_url":"https://codeload.github.com/RisingStack/graffiti/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245217352,"owners_count":20579290,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-31T08:00:52.423Z","updated_at":"2025-03-24T05:33:24.926Z","avatar_url":"https://github.com/RisingStack.png","language":"JavaScript","readme":"# \u0026#9888; Notice: the development of the package is discontinued. Use it for educational purposes and hobby projects only.\n\n# ![graffiti](https://cloud.githubusercontent.com/assets/1764512/8900273/9ed758dc-343e-11e5-95ba-e82f876cf52d.png)\n\n[![npm version](https://badge.fury.io/js/%40risingstack%2Fgraffiti.svg)](https://badge.fury.io/js/%40risingstack%2Fgraffiti)\n[ ![Codeship Status for RisingStack/graffiti](https://codeship.com/projects/0c4fb010-5969-0133-8c37-4255fd5efb39/status?branch=master)](https://codeship.com/projects/110029)\n[![bitHound Overall Score](https://www.bithound.io/github/RisingStack/graffiti/badges/score.svg)](https://www.bithound.io/github/RisingStack/graffiti)\n[![Known Vulnerabilities](https://snyk.io/test/npm/@risingstack/graffiti/badge.svg)](https://snyk.io/test/npm/@risingstack/graffiti)\n\nCurrently the consumption of HTTP REST APIs dominate the client-side world,\n[GraphQL](https://github.com/facebook/graphql) aims to change this.\nThis transition can be time-consuming - this is where graffiti comes into the picture.\n\nWe don't want to rewrite our application - no one wants that.\ngraffiti provides an [Express](http://expressjs.com) middleware, a [Hapi](http://hapijs.com) plugin and a\n[Koa](http://koajs.com) middleware to convert your existing models into a GraphQL schema and exposes it over HTTP.\n\n## What is GraphQL?\n\nGraphQL is a query language created by Facebook in 2012 which provides a common interface between the client and the server for data fetching and manipulations.\n\nThe client asks for various data from the GraphQL server via queries. The response format is described in the query and defined by the client instead of the server: they are called client‐specified queries.\n\nFor more info check out RisingStack's [GraphQL tutorial](https://blog.risingstack.com/graphql-overview-getting-started-with-graphql-and-nodejs/).\n\n## Example server and queries\n\nFor a running **example server** and **executable queries**, check out our example repository and play with your GraphQL queries: [graffiti-example](https://github.com/RisingStack/graffiti/tree/master/example)\n\n## Adapters\n\n* [mongoose](https://github.com/RisingStack/graffiti-mongoose)\n* more coming...\n\n## Supported servers\n\n* [Express](https://github.com/RisingStack/graffiti#express)\n* [Hapi](https://github.com/RisingStack/graffiti#hapi)\n* [Koa](https://github.com/RisingStack/graffiti#koa)\n\n## Install\n\n```bash\nnpm install @risingstack/graffiti --save\n```\n\n## Usage\n\n0. run MongoDB\n1. register the middleware\n2. provide a schema (returned by an adapters `getSchema` method or your own `GraphQLSchema` instance)\n3. the GraphQL endpoint is available on `/graphql`\n\n### Express\n\n```javascript\nimport express from 'express';\nimport { json } from 'body-parser';\nimport graffiti from '@risingstack/graffiti';\nimport { getSchema } from '@risingstack/graffiti-mongoose';\n\nimport Cat from './models/Cat';\nimport User from './models/User';\n\nconst app = express();\n\n// parse body as json\napp.use(json());\n\napp.use(graffiti.express({\n  schema: getSchema([User, Cat]),\n  context: {} // custom context\n}));\n\napp.listen(3000);\n```\n\n### Hapi\n\n```javascript\nimport { Server } from 'hapi';\nimport graffiti from '@risingstack/graffiti';\nimport { getSchema } from '@risingstack/graffiti-mongoose';\n\nconst server = new Server();\nserver.connection({ port: 3000 });\n\nserver.register({\n  register: graffiti.hapi,\n  options: {\n    schema: getSchema([User, Cat]),\n    context: {}, // custom context \n    config: {} // config parameter for hapi graphql route\n  }\n}, function (err) {\n  if (err) {\n    console.error('Failed to load plugin:', err);\n  }\n\n  server.start(function () {\n      console.log('Server running at:', server.info.uri);\n  });\n});\n```\n\n### Koa\n\n```javascript\nimport koa from 'koa';\nimport parser from 'koa-bodyparser';\nimport graffiti from '@risingstack/graffiti';\nimport { getSchema } from '@risingstack/graffiti-mongoose';\n\nimport Cat from './models/Cat';\nimport User from './models/User';\n\nconst app = koa();\n\napp.use(parser());\n\napp.use(graffiti.koa({\n  schema: getSchema([User, Cat]),\n  context: {} // custom context\n}));\n\napp.listen(3000);\n```\n\n## Options\n\n- `schema`: a `GraphQLSchema` instance. You can use an adapters `getSchema` method, or provide your own schema. (required)\n- `graphiql`: may present [GraphiQL](https://github.com/graphql/graphiql) when loaded directly from a browser. (default: `true`)\n- `context`: custom GraphQL context object. (default: `{}`)\n\n## Test\n\n```bash\nnpm test\n```\n","funding_links":[],"categories":["JavaScript","Libraries","Community","Uncategorized"],"sub_categories":["JavaScript Libraries","Uncategorized"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FRisingStack%2Fgraffiti","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FRisingStack%2Fgraffiti","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FRisingStack%2Fgraffiti/lists"}