{"id":13515263,"url":"https://github.com/oslabs-beta/Olympus","last_synced_at":"2025-03-31T04:36:57.108Z","repository":{"id":38819484,"uuid":"489511384","full_name":"oslabs-beta/Olympus","owner":"oslabs-beta","description":"A hybrid caching library for GraphQL written for Javascript Express","archived":false,"fork":false,"pushed_at":"2023-03-10T23:53:20.000Z","size":79443,"stargazers_count":53,"open_issues_count":0,"forks_count":4,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-30T11:35:32.072Z","etag":null,"topics":["caching","graphql","graphql-server","localstorage","redis","typescript"],"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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"open-source-labs","custom":["https://donorbox.org/donations-to-oslabs-inc"]}},"created_at":"2022-05-06T22:42:24.000Z","updated_at":"2024-08-16T20:05:40.000Z","dependencies_parsed_at":"2024-11-01T19:31:39.045Z","dependency_job_id":"4c109f77-0019-47ee-8370-d8a896d76103","html_url":"https://github.com/oslabs-beta/Olympus","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%2FOlympus","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oslabs-beta%2FOlympus/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oslabs-beta%2FOlympus/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oslabs-beta%2FOlympus/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/oslabs-beta","download_url":"https://codeload.github.com/oslabs-beta/Olympus/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246418657,"owners_count":20773934,"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":["caching","graphql","graphql-server","localstorage","redis","typescript"],"created_at":"2024-08-01T05:01:08.560Z","updated_at":"2025-03-31T04:36:52.074Z","avatar_url":"https://github.com/oslabs-beta.png","language":"JavaScript","funding_links":["https://github.com/sponsors/open-source-labs","https://donorbox.org/donations-to-oslabs-inc"],"categories":["JavaScript"],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003cimg \n    src=\"/Logos/OlympusFixed.png\"\n  \u003e\n\u003c/p\u003e\n\n\u003ch1 align=\"center\"\u003eWelcome to \u003ca href=\"http://olympuscache.com\" target=\"_blank\"\u003eOlympus Caching!\u003c/a\u003e\u003c/h1\u003e\n\n# [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen)]() [![Licence](https://img.shields.io/github/license/Ileriayo/markdown-badges?style=for-the-badge)](./LICENSE) [![NPM](https://img.shields.io/badge/NPM-%23000000.svg?style=for-the-badge\u0026logo=npm\u0026logoColor=white)](https://www.npmjs.com/package/olympus-cache) [![Medium](https://img.shields.io/badge/Medium-12100E?style=for-the-badge\u0026logo=medium\u0026logoColor=white)](https://medium.com/@marshallkkim29/olympus-an-intuitive-hybrid-caching-solution-for-graphql-b18a08c5045d) [![LinkedIn](https://img.shields.io/badge/linkedin-%230077B5.svg?style=for-the-badge\u0026logo=linkedin\u0026logoColor=white)](https://www.linkedin.com/company/olympus-caching/)\n\nOlympus is a hybrid caching library for GraphQL written for Javascript Express\n\n## Features\n- Automatically creates and caches GraphQL queries.\n- Integrates with any server running on Express/Node.js.\n- Includes caching with Redis and in the browser's local storage.\n\nCheck out [our demo site](http://olympuscache.com) to see what Olympus can do.\n\n---\n## Table of Contents\n- [Install](#install)\n- [Server Setup](#server)\n- [Making Queries (Client-side)](#queries)\n- [Making Mutations (Client-side)](#mutations)\n- [The Team ](#team )\n- [License](#license )\n---\n\n## \u003ca name=\"install\"/\u003e Install Olympus\nInstall our Express library via npm\n\n```bash\nnpm install olympus-cache\n```\n\n## \u003ca name=\"server\"/\u003e Set up your Express server\n1. Import our Redis Middleware\n\n```javascript\nconst RedisCache = require('olympus-server');\n```\n\n2. Set up your Redis Server\n\n```javascript\nconst redis = require('redis');\nconst redisClient = redis.createClient({\n    host: \"localhost\",\n    port: 6379,\n  });\nredisClient.connect();\nconst redisInstance = new RedisCache(redisClient, '//insert url with /graphql endpoint here');\n\n// REQUIRED\napp.use(express.json())\napp.use(express.urlencoded({ extended: true }));\n```\n\n3. Add the following endpoints\n\n```javascript\napp.use('/olympus', redisInstance.cacheResponse, (req, res) =\u003e {\n    res.status(200).send(res.locals)\n});\napp.use('/graphql', graphqlHTTP({schema, graphiql: true}));\n```\n\n4. Don't forget to run the command line 'redis-server' on the machine with your server\n\n## \u003ca name=\"queries\"/\u003e Making Queries\n1. Import `Olympus` in files that make GraphQL queries\n\n```javascript\nimport { Olympus } from 'olympus-fetch';\n```\n\n2. Olympus is designed to make it easy to switch over from the Fetch API. All you have to do is replace the word `fetch` with the word `Olympus`. Remove the endpoint argument, and adjust the 'body' key inside the second arugment.\n\nFor example, here's how you might send a GraphQL request using the Fetch API:\n\n```javascript\nfetch('/graphql', {\n  method: 'POST',\n  headers: { 'Content-Type': 'application/graphql' },\n  body: // query string\n})\n.then(/* code */)\n```\n\nAnd here's what that same request looks like using Olympus:\n\n```javascript\nOlympus({\n  method: 'POST',\n  headers: { 'Content-Type': 'application/graphql' },\n  body: JSON.stringify({query: // query string})\n})\n.then(/* code */)\n```\n\nSimply replace `fetch` with `Olympus` wherever the client-side code queries the GraphQL API, and you're done! You've set up caching inside your client's browser Local Storage.\n\n## \u003ca name=\"mutations\"/\u003e Making Mutations\nIn order to make a mutation, follow the same steps above. Simply replace `fetch` with `Olympus` wherever the client-side code makes mutations using the GraphQL API, and you're done! Simply enter your string containing the mutation inside of the key \"query\".\n\n```javascript\nOlympus({\n  method: 'POST',\n  headers: { 'Content-Type': 'application/graphql' },\n  body: JSON.stringify({query: // mutation string})\n})\n.then(/* code */)\n```\n\n## \u003ca name=\"team \"/\u003e The Team\nAdam Lang   | [GitHub](https://github.com/AdamLang96) | [LinkedIn](https://www.linkedin.com/in/adam-lang-573a2b149/)\n\u003cbr\u003e\nBryan Kim   | [GitHub](https://github.com/Bkimmm) | [LinkedIn](https://www.linkedin.com/in/bkimmm/)\n\u003cbr\u003e\nKevin Le    | [GitHub](https://github.com/kle160) | [LinkedIn](https://www.linkedin.com/in/kevin-le-3ab05971/)\n\u003cbr\u003e\nMarshall Kim    | [GitHub](https://github.com/marshallkkim) | [LinkedIn](https://www.linkedin.com/in/marshallkkim/)\n\n## \u003ca name=\"license\"/\u003e License\nThis product is licensed under the MIT License - see the LICENSE file for details.\n\nThis is an open source product.\n\nThis product is accelerated by [OS Labs](https://opensourcelabs.io/).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foslabs-beta%2FOlympus","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foslabs-beta%2FOlympus","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foslabs-beta%2FOlympus/lists"}