{"id":13727160,"url":"https://github.com/open-source-labs/obsidian","last_synced_at":"2025-05-16T12:07:02.075Z","repository":{"id":38523104,"uuid":"291299977","full_name":"open-source-labs/obsidian","owner":"open-source-labs","description":"GraphQL, built for Deno - a native GraphQL caching client and server module","archived":false,"fork":false,"pushed_at":"2024-05-17T20:42:12.000Z","size":4325,"stargazers_count":760,"open_issues_count":4,"forks_count":113,"subscribers_count":11,"default_branch":"master","last_synced_at":"2025-05-09T04:01:46.006Z","etag":null,"topics":["deno","graphql","javascript","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/open-source-labs.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":"2020-08-29T15:45:03.000Z","updated_at":"2025-03-22T01:01:57.000Z","dependencies_parsed_at":"2024-01-25T05:29:17.266Z","dependency_job_id":"5c491f8f-cb4e-422d-bceb-533576c58e56","html_url":"https://github.com/open-source-labs/obsidian","commit_stats":{"total_commits":464,"total_committers":45,"mean_commits":"10.311111111111112","dds":0.8836206896551724,"last_synced_commit":"0e4c2ca02e30d099dfc30dae3b6ef3a3534f03a2"},"previous_names":["oslabs-beta/obsidian"],"tags_count":24,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/open-source-labs%2Fobsidian","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/open-source-labs%2Fobsidian/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/open-source-labs%2Fobsidian/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/open-source-labs%2Fobsidian/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/open-source-labs","download_url":"https://codeload.github.com/open-source-labs/obsidian/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254105164,"owners_count":22015603,"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":["deno","graphql","javascript","typescript"],"created_at":"2024-08-03T01:03:42.187Z","updated_at":"2025-05-16T12:07:02.032Z","avatar_url":"https://github.com/open-source-labs.png","language":"TypeScript","readme":"![Obsidian](./assets/bannerfull_gradient.png)\n\n\u003cdiv align=\"center\"\u003eGraphQL, built for Deno.\u003c/div\u003e\n\n\u003cdiv align=\"center\"\u003e\n\n\u003ch1 align=\"center\"\u003e\n\t\u003ca\u003eObsidian\u003c/a\u003e\n\t\u003ca href=\"https://twitter.com/intent/tweet?text=Meet%20Obsidian!%20Deno's%20first%20native%20GraphQL%20caching%20client%20and%20server%20module\u0026url=http://obsidian.land/\u0026via=obsidian_land\u0026hashtags=deno,denoland,nodejs,graphql,javascript\" rel=\"nofollow\"\u003e\u003cimg src=\"https://camo.githubusercontent.com/83d4084f7b71558e33b08844da5c773a8657e271/68747470733a2f2f696d672e736869656c64732e696f2f747769747465722f75726c2f687474702f736869656c64732e696f2e7376673f7374796c653d736f6369616c\" alt=\"Tweet\" data-canonical-src=\"https://img.shields.io/twitter/url/http/shields.io.svg?style=social\" style=\"max-width:100%;\"\u003e\u003c/a\u003e\n\u003c/h1\u003e\n\n\u003c/div\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003cimg alt=\"GitHub\" src=\"https://img.shields.io/github/license/open-source-labs/obsidian\"\u003e\n  \u003cimg alt=\"GitHub issues\" src=\"https://img.shields.io/github/issues-raw/open-source-labs/obsidian?color=yellow\"\u003e\n  \u003cimg alt=\"GitHub last commit\" src=\"https://img.shields.io/github/last-commit/open-source-labs/obsidian?color=orange\"\u003e\n  \u003cimg alt=\"GitHub Repo stars\" src=\"https://img.shields.io/github/stars/open-source-labs/obsidian?style=social\"\u003e  \n\u003c/p\u003e\n\n## Features\n\n- (New!) Support for W-TinyLFU client-side cache that brings great hit-ratio performance with minimal memory overhead\n- (New!) Option to provide Obsidian with the search types your application uses, allowing data cached from complete dataset pulls to be accessible later on in searches for individual items\n- (New!) Refactored server-side caching with Redis\n- (New!) Rebuilt developer tool for Obsidian 8.0 for testing and analytics related to the new client caching options\n- (New!) Option for persistent queries, allowing only a smaller hash to be sent to the server on client-side cache misses, minimizing the cost of queries. Note that while this will increase the overall performance for frequent, repeat queries.\n- Flexible cache responds only with data requested from selected fields\n- GraphQL query abstraction and caching improving the performance of your app\n- SSR React wrapper, allowing you to cache in browser\n- Configurable caching options, giving you complete control over your cache\n- Fullstack integration, leveraging client-side and server-side caching to streamline your caching strategy\n- Support for the full GraphQL convention\n- Support for client-side and server-side cache invalidation\n- Optional GraphQL DoS attack mitigation security module\n\n## Overview\n\nObsidian is Deno's first native GraphQL caching client and server module. Boasting lightning-fast caching and fetching capabilities alongside headlining normalization and rebuilding strategies, Obsidian is equipped to support scalable, highly performant applications.\n\nWith additional support for use in server-side rendered React apps built with Deno, full stack integration of Obsidian enables a fast and flexible caching solution.\n\n## Installation\n\n\u003cdiv align=\"center\"\u003e\u003cstrong\u003eQUICK START\u003c/strong\u003e\u003c/div\u003e\n\u003cbr\u003e\n\n## Creating the Router\n\n```javascript\nimport { Application, Router } from 'https://deno.land/x/oak@v6.0.1/mod.ts';\nimport { ObsidianRouter, gql } from 'https://deno.land/x/obsidian/mod.ts';\nimport { resolvers } from './ import from your resolvers file';\nimport { types } from './ import your schema/types from schema/types file';\n\ninterface ObsRouter extends Router {\n  obsidianSchema?: any;\n}\n\nconst GraphQLRouter =\n  (await ObsidianRouter) \u003c\n  ObsRouter \u003e\n  {\n    Router, // your router in deno\n    typeDefs: types, // graphQL typeDefs\n    resolvers: resolvers, // graphQL resolvers\n  };\n\n// attach the graphql router's routes to your deno app\napp.use(GraphQLRouter.routes(), GraphQLRouter.allowedMethods());\n```\n## Selecting options for the Router\n```javascript\nconst GraphQLRouter =\n  (await ObsidianRouter) \u003c\n  ObsRouter \u003e\n  {\n    Router, // Router that is initialized by server.\n    path: '/graphql', // endpoint for graphQL queries, default to '/graphql'\n    typeDefs: types, // graphQL typeDefs\n    resolvers: resolvers, // graphQL resolvers\n    usePlayground: true, // Boolean to allow for graphQL playground, default to false\n    useCache: true, // Boolean to toggle all cache functionality, default to true\n    redisPort: 6379, // Desired redis port, default to 6379\n    policy: 'allkeys-lru', // Option select your Redis policy, default to allkeys-lru\n    maxmemory: '2000mb', // Option to select Redis capacity, default to 2000mb\n    searchTerms: [] //Optional array to allow broad queries to store according to search fields so individual searches are found in cache\n    persistQueries: true, //Boolean to toggle the use of persistent queries, default to false - NOTE: if using, must also be enabled in client wrapper\n    hashTableSize: 16, // Size of hash table for persistent queries, default to 16\n    maxQueryDepth: 0, // Maximum depth of query, default to 0\n    customIdentifier: ['__typename', '_id'], // keys to be used to idedntify and normalize object\n    mutationTableMap: {}, //Object where keys are add mutation types and value is an array of affected tables (e.g. {addPlants: ['plants'], addMovie: ['movies']})\n  };\n```\n\n## Creating the Wrapper\n\n```javascript\nimport { ObsidianWrapper } from 'https://deno.land/x/obsidian/clientMod.ts';\n\nconst App = () =\u003e {\n  return (\n    \u003cObsidianWrapper\u003e\n      \u003cMovieApp /\u003e\n    \u003c/ObsidianWrapper\u003e\n  );\n};\n```\n\n## Selecting options for the Wrapper\n\n```javascript\n\u003cObsidianWrapper \n  useCache={true} // Boolean indicating whether to use client-side cache, default to true\n  algo='LRU' // String indicating cache policy to use for client-side cache, default to LFU. OTHER OPTIONS: W-Tiny-LFU, LRU\n  capacity='5000' // String indicating numeric capacity of cache, default to 2000\n  persistQueries={true} // Boolean indicating wheter to use persistent queries, default to false\n  searchTerms={['title', 'director', 'genre']} // Optional parameter to set search terms of the data\n\u003e\n  \u003cMovieApp /\u003e\n\u003c/ObsidianWrapper\u003e\n```\n\n## Making a Query\n\n```javascript\nimport { useObsidian } from 'https://deno.land/x/obsidian/clientMod.ts';\n\nconst MovieApp = () =\u003e {\n  const { query } = useObsidian();\n  const [movies, setMovies] = (React as any).useState('');\n\n  const queryStr = `query {\n      movies {\n        id\n        title\n        releaseYear\n        genre\n      }\n    }\n  `;\n\n  return (\n    \u003ch1\u003e{movies}\u003c/h1\u003e\n    \u003cbutton\n      onClick={() =\u003e {\n        query(queryStr)\n        .then(resp =\u003e setMovies(resp.data))\n      }}\n    \u003eGet Movies\u003c/button\u003e\n  );\n};\n```\n\n## Making a Mutation\n\n```javascript\nimport { useObsidian } from 'https://deno.land/x/obsidian/clientMod.ts';\n\nconst MovieApp = () =\u003e {\n  const { mutate } = useObsidian();\n  const [movies, setMovies] = (React as any).useState('');\n\n  const queryStr = `mutation {\n    addMovie(input: {title: \"Cruel Intentions\", releaseYear: 1999, genre: \"DRAMA\" }) {\n      id\n      title\n      releaseYear\n      genre\n    }\n  }\n  `;\n\n  return (\n    \u003ch1\u003e{movies}\u003c/h1\u003e\n    \u003cbutton\n      onClick={() =\u003e {\n        mutate(queryStr)\n        .then(resp =\u003e setMovies(resp.data))\n      }}\n    \u003eGet Movies\u003c/button\u003e\n  );\n}\n```\n## Setting up Redis\n\nIn order to utilize server side caching, a Redis instance must be available and running. Redis installation and quick-start documentation can be found [here](https://redis.io/docs/getting-started/). Make sure to keep a redis instance running whenever the application is utilizing server side caching to avoid running into issues.\n\nTo connect Obsidian to Redis, create a .env file in the root directory of the application with the following information:\n\n```javascript\nREDIS_HOST= //string of redis host name, typically defaulted to '127.0.0.1' by Redis\n```\nBe sure to also specify the Redis TCP port by passing in the port number as an argument into Obsidian Router (see Selecting options for the Router above).\n\n\n## Documentation\n\n[getobsidian.io](http://getobsidian.io/)\n\n## Developer Tool\n\nInformation and instructions on how to use our developer tool can be found here \u003cbr/\u003e\nworks with Obsidian 8.0 \u003cbr/\u003e\n[open-source-labs/obsidian-developer-tool](https://github.com/open-source-labs/obsidian-developer-tool)\n\n## Obsidian 8.0 Demo\n\nGithub for a demo with some example code to play with: \u003cbr/\u003e\n[oslabs-beta/obsidian-demo-8.0](https://github.com/oslabs-beta/obsidian-8.0-demo)\n\n## Features In Progress\n\n- Server-side caching improvements\n- More comprehensive mutation support\n- searchTerms option optimization\n- Ability to store/read only the whole query \n- Hill Climber optimization for W-TinyLFU cache size allocation\n- Developer Tool server-side cache integration\n- Developer Tool View Cache component, and Playground component\n\n## Authors\n[David Kim](https://github.com/davidtoyoukim)   \n[David Norman](https://github.com/DavidMNorman)   \n[Eileen Cho](https://github.com/exlxxn)   \n[Joan Manto](https://github.com/JoanManto)    \n[Alex Lopez](https://github.com/AlexLopez7)   \n[Kevin Huang](https://github.com/kevin-06-huang)    \n[Matthew Weisker](https://github.com/mweisker)    \n[Ryan Ranjbaran](https://github.com/ranjrover)    \n[Derek Okuno](https://github.com/okunod)  \n[Liam Johnson](https://github.com/liamdimitri)  \n[Josh Reed](https://github.com/joshreed104)  \n[Jonathan Fangon](https://github.com/jonathanfangon)  \n[Liam Jeon](https://github.com/laj52)  \n[Yurii Shchyrba](https://github.com/YuriiShchyrba)  \n[Linda Zhao](https://github.com/lzhao15)  \n[Ali Fay](https://github.com/ali-fay)  \n[Anthony Guan](https://github.com/guananthony)  \n[Yasir Choudhury](https://github.com/Yasir-Choudhury)  \n[Yogi Paturu](https://github.com/YogiPaturu)  \n[Michael Chin](https://github.com/mikechin37)  \n[Dana Flury](https://github.com/dmflury)  \n[Sardor Akhmedov](https://github.com/sarkamedo)  \n[Christopher Berry](https://github.com/cjamesb)  \n[Olivia Yeghiazarian](https://github.com/Olivia-code)  \n[Michael Melville](https://github.com/meekle)  \n[John Wong](https://github.com/johnwongfc)  \n[Kyung Lee](https://github.com/kyunglee1)  \n[Justin McKay](https://github.com/justinwmckay)  \n[Patrick Sullivan](https://github.com/pjmsullivan)  \n[Cameron Simmons](https://github.com/cssim22)  \n[Raymond Ahn](https://github.com/raymondcodes)  \n[Alonso Garza](https://github.com/Alonsog66)  \n[Burak Caliskan](https://github.com/CaliskanBurak)  \n[Matt Meigs](https://github.com/mmeigs)  \n[Travis Frank](https://github.com/TravisFrankMTG/)  \n[Lourent Flores](https://github.com/lourentflores)  \n[Esma Sahraoui](https://github.com/EsmaShr)  \n[Derek Miller](https://github.com/dsymiller)  \n[Eric Marcatoma](https://github.com/ericmarc159)  \n[Spencer Stockton](https://github.com/tonstock)\n","funding_links":["https://github.com/sponsors/open-source-labs","https://donorbox.org/donations-to-oslabs-inc"],"categories":["TypeScript"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopen-source-labs%2Fobsidian","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fopen-source-labs%2Fobsidian","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopen-source-labs%2Fobsidian/lists"}