{"id":15407185,"url":"https://github.com/ltfschoen/graphql_sequelize","last_synced_at":"2026-04-20T03:02:50.286Z","repository":{"id":76620079,"uuid":"78338343","full_name":"ltfschoen/graphql_sequelize","owner":"ltfschoen","description":"GraphQL overlaying Sequelize using PostgreSQL database","archived":false,"fork":false,"pushed_at":"2017-01-11T01:39:36.000Z","size":9,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-28T02:28:32.583Z","etag":null,"topics":["express","graphiql","graphql-sequelize","postgresql"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ltfschoen.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-01-08T11:19:49.000Z","updated_at":"2017-05-25T12:26:48.000Z","dependencies_parsed_at":null,"dependency_job_id":"3da37f85-89c2-4bca-8d1e-94c76ab581fc","html_url":"https://github.com/ltfschoen/graphql_sequelize","commit_stats":{"total_commits":9,"total_committers":1,"mean_commits":9.0,"dds":0.0,"last_synced_commit":"335761302ba4d42fea98414639ebe4885d498afb"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ltfschoen/graphql_sequelize","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ltfschoen%2Fgraphql_sequelize","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ltfschoen%2Fgraphql_sequelize/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ltfschoen%2Fgraphql_sequelize/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ltfschoen%2Fgraphql_sequelize/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ltfschoen","download_url":"https://codeload.github.com/ltfschoen/graphql_sequelize/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ltfschoen%2Fgraphql_sequelize/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32031070,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-20T00:18:06.643Z","status":"online","status_checked_at":"2026-04-20T02:00:06.527Z","response_time":94,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["express","graphiql","graphql-sequelize","postgresql"],"created_at":"2024-10-01T16:27:30.442Z","updated_at":"2026-04-20T03:02:50.269Z","avatar_url":"https://github.com/ltfschoen.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Setup\n\n## Initialise Git, NPM, Babel transpiler, and install dependencies\n```\ngit init\nnpm init\ntouch .babelrc\nnpm install --save babel-preset-node5\n```\n\n## Setup Sequelize instance in db.js, install Sequalize and drivers\n```\ntouch db.js\nnpm install --save sequelize pg pg-hstore\n```\n\n## Define associations and syncronise and create tables using Faker library\n```\nnpm install --save lodash faker\ntouch config/config.json\n```\n\n## Run app to create relational database\n```\nbabel-node db.js\n```\n\n## Open PostgreSQL (PSQL) CLI database with master as username\n```\npsql graphql_sequelize master\n```\n\n## Show tables within PSQL and select all columns in each table\n```\n\\d\nselect * from containers;\nselect * from sections;\n```\nNote: sections table has a containerId column due to association\n\n## Create GraphQL Schema schema.js (layer on top of Sequelize Schema and relational database)\n\n## Import Sequelize DB instance and Schema to overlay it with GraphQL Type System\n\n## Install GraphQL tooling with `graphql` to use GraphQL Spec and then import into GraphQL server\n```\nnpm install --save graphql\n```\n\n## Install React and React DOM dependencies for GraphiQL\n```\nnpm install --save react react-dom\n```\n\n## Define Individual Types (i.e. for Container and Section tables) in schema.js\n## Define Query Types\n## Define Root Query (GraphQL checks to find shape of data to return) and whose fields function returns Public API Methods and Args that may be restricted \n## Create Schema instance where Query instance is an options property of it\n\n## Create Express server to allow sending HTTP Requests (i.e. GET) to GraphQL endpoint\n## Use 'express-graphql' as GraphQL Middleware so GraphQL endpoint spawns quickly\nhttps://github.com/graphql/express-graphql\n```\nnpm install --save express express-graphql graphiql\n```\n\n## Install dependencies of GraphiQL\n```\nnpm install --save react react-dom\n```\n\n## Run instead with and go to [localhost:3000/graphql](localhost:3000/graphql):\n```\nbabel-node server.js\n```\n\n## Click Docs to show able to search on id query parameter\n\n## Run Independent Query on 'containers' field\n\n## Create query and press Play button to return response\n```\n{\n  containers {\n    id\n    data {\n      field1\n      field2\n      field3\n    }\n  }\n}\n```\n\n## Restart server\n\n## Run Independent Query on 'sections' field and repeat\n```\n{\n  sections {\n    id\n  }\n}\n```\n\n## Run Combined (Bi-directional) Query fields (benefit of GraphQL is Batches Requests from frontend) not being limited to independent endpoints like in RESTful API that only serves static data structures\n```\n{\n  containers {\n    id\n    data {\n      field1\n      field2\n      field3\n    }\n    sections {\n    \tid\n    }\n  }\n}\n\n{\n  sections {\n    id\n    container {\n    \tid\n        data {\n          field1\n          field2\n          field3\n        }\n    \tsections {\n    \t\tid\n        container {\n    \t\t\tid\n        }\n    \t}\n    }\n  }\n}\n```\n\n## Alternatively go to URL below, then click Prettify\n\nhttp://localhost:3000/graphql?query={sections{id,container{id}}}\n\n## Mutations instance added to GraphQL Schema to write to DB using HTTP POST\n\n## Call Public API from command line tools\n```\ncurl -X POST http://localhost:3000/graphql \\\n  -H \"Content-Type: application/graphql\" \\\n  -d '{ containers { id, sections { id } } }'\n```\n\n## Run Mutation query\n\n## Specify return expectations\n```\nmutation addContainer {\n\taddContainer(id: \"TestContainer\") {\n\t\tid\n\t}\n}\n```\n\n## Links and Fragments (grouping by Store)\n\n* https://github.com/graphql/graphql-js/issues/19\n* https://github.com/facebook/relay/issues/77\n* https://github.com/graphql/express-graphql\n* https://learngraphql.com/basics/introduction\n* https://developer.github.com/early-access/graphql/object/query/","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fltfschoen%2Fgraphql_sequelize","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fltfschoen%2Fgraphql_sequelize","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fltfschoen%2Fgraphql_sequelize/lists"}