{"id":26267337,"url":"https://github.com/oslabs-beta/aqls-server","last_synced_at":"2025-04-30T19:08:29.196Z","repository":{"id":57098473,"uuid":"298677509","full_name":"oslabs-beta/Aqls-server","owner":"oslabs-beta","description":"An intelligent full-stack GraphQL subscription and analytics module. Server-side analytics processing, self-auditing router, and resolver plugins.","archived":false,"fork":false,"pushed_at":"2020-10-22T19:11:35.000Z","size":170,"stargazers_count":123,"open_issues_count":0,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-30T19:07:17.738Z","etag":null,"topics":["apollo-server-express","graphql"],"latest_commit_sha":null,"homepage":"","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/oslabs-beta.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-09-25T20:54:41.000Z","updated_at":"2024-05-02T11:59:16.000Z","dependencies_parsed_at":"2022-08-20T17:31:19.762Z","dependency_job_id":null,"html_url":"https://github.com/oslabs-beta/Aqls-server","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oslabs-beta%2FAqls-server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oslabs-beta%2FAqls-server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oslabs-beta%2FAqls-server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oslabs-beta%2FAqls-server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/oslabs-beta","download_url":"https://codeload.github.com/oslabs-beta/Aqls-server/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251767189,"owners_count":21640469,"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":["apollo-server-express","graphql"],"created_at":"2025-03-14T04:16:32.769Z","updated_at":"2025-04-30T19:08:29.166Z","avatar_url":"https://github.com/oslabs-beta.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Aqls - Server\n\n\n## Overview\nGraphQL analytics toolkit and dashboard that integrate with Apollo Client and Apollo Server Express. It is an easy to use analytics suite that monitors GraphQL subscriptions concurrency, latency, errors, and resolver frequency. Our integrated dashboard displays your GraphQL analytics on dynamic and interactive charts. \n\nThis package is for setting up your server. For the client-side package please refer to the [Aqls-client](https://github.com/oslabs-beta/Aqls-client) package.\n\n**Note:** Aqls is currently in BETA and improvements will continue to be implemented. If any issues are encountered while using our application, please submit a PR. \n\n\n## Requirements\n- **Node.js** *version* 12.18.3+\n- **apollo-server-express** *version* 2.18.1+\n\n## Install\nWith npm:\n\n```\nnpm install --save @aqls/server\n```\n\n## Getting Started\n\n####\n- [ ] **1**. Import Traql, traqlAudit, and analyticsRouter into your server file:\n\n```javascript\nconst { Traql, traqlAudit, analyticsRouter } = require('@aqls/server');\n```\n#### \n\n- [ ] **2**. Initialize a constant for your resolvers:\n```javascript\nconst resolvers = { Mutation, Query, Subscription };\n ```\n####\n- [ ] **3**. Create a new instance of Traql passing in the resolvers and your user token:\n```javascript\nconst traql = new Traql(resolvers, 'INSERT USER TOKEN HERE IN QUOTES');\n```\nThis will keep track of the number of subscription resolvers in the system and will calculate the number of current subscribers. You can get your User Token from [Aqls.io](https://www.aqls.io/) by signing up through Github OAuth. This token is needed to view your analytics in the developer dashboard at Aqls.io. \n####\n- [ ] **4**. Add to your Apollo Server: \n```javascript\nconst server = new ApolloServer({\n  typeDefs,\n  resolvers,\n  context: { db, pubsub, traql },\n});\n```\nMake sure that *context* is added to your server. Be sure to pass in **BOTH** *pubsub* and *traql* to server context.\n ####\n- [ ] **5**. Invoke the traqlAudit function passing in traql: \n```javascript\nsetInterval(() =\u003e traqlAudit(traql), 5000);\n```\ntraqlAudit is invoked every 5 seconds to audit each traql entry and ensure that there are no errors before sending the data to be displayed on the dashboard.\n ####\n- [ ] **6**. Instantiate an endpoint to send analytics to Aqls server:\n```javascript\napp.use('/aqlsanalytics', analyticsRouter(traql));\n```\n**Note:** Please ensure the endpoint is *'/aqlsanalytics'* and invoke *analyticsRouter* passing in *traql*.\n###\n###\n## Update Schema and Mutation Tracking\n- [ ] **1**. Add AQL and AQLInput to schema file:\n```graphQL\ntype AQL {\n  mutationSendTime: String,\n  mutationReceived: String,\n  subscriberReceived: String,\n  mutationId: ID,\n  resolver: String,\n  userToken: String,\n}\ninput AQLInput {\n  mutationSendTime: String,\n  mutationReceived: String,\n  subscriberReceived: String,\n  mutationId: ID,\n  resolver: String,\n  userToken: String,\n}\n```\n###\n- [ ] **2**. Add AQLInput type to any mutation type that you want to track:\n```graphQL\ntype Mutation {\n  newColor(colorArg: String, aql: AQLInput): Color\n  newLuckyNumber(numberArg: Int, aql: AQLInput): LuckyNumber\n}\n```\n###\n- [ ] **3**. Add AQL type to any payload that you want to track:\n```graphQL\ntype UpdatedColorPayload {\n  cssColor: String!\n  id: ID!\n  aql: AQL\n}\n```\n###\n###\n### Mutation Tracking\n- [ ] **1**. Import newAqlPayload in mutation resolver file: \n```javascript\nconst { newAqlPayload } = require('@aqls/server');\n```\n- [ ] **2**. Pass invocation of newAqlPayload to pubsub publish property:\n```javascript\nfunction newColor(parent, args, { db, pubsub, traql }, info) {\n  db.color.cssColor = args.colorArg;\n  const payload = {\n    updatedColor: {\n      ...db.color,\n    },\n  };\n  pubsub.publish('COLOR_MUTATED', newAqlPayload(payload, args, traql, pubsub));\n  return db.color;\n}\n```\n**Note:** Pass in payload as first argument, be sure to include resolver arguments and the traql and pubsub from server context.\n####\n####\n- [ ] **Lastly, Connect with the Aqls Team!**\n\naqlorgteam@gmail.com\n\nCase Simmons: [Case's Github](https://github.com/casesimmons) and [Case's LinkedIn](https://www.linkedin.com/in/case-simmons/)\n\nJulie Pinchak: [Julie's Github](https://github.com/jpinchak) and [Julie's LinkedIn](https://www.linkedin.com/in/julie-pinchak/)\n\nMichael O'Halloran: [Michael's Github](https://github.com/LordRegis22) and [Michael's LinkedIn](https://www.linkedin.com/)\n\nRocio Infante: [Rocio's Github](https://github.com/Rocio-Infante) and [Rocio's LinkedIn](https://www.linkedin.com/in/rocio-infante/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foslabs-beta%2Faqls-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foslabs-beta%2Faqls-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foslabs-beta%2Faqls-server/lists"}