loading...
Cover image for Obsidian - GraphQL caching client & server module for Deno
GraphQL Editor

Obsidian - GraphQL caching client & server module for Deno

tomekponiat profile image Tomek Poniatowicz ・2 min read

Deno is a V8-based scripting environment written in Rust & TypeScript aiming to provide a productive, secure scripting environment that a modern programmer needs. Deno aims to overcome all the design flaws and weaknesses of Node. Obsidian is a GraphQL caching client and server module built for Deno.

Obsidian

Obsidian provides a solution to one of the most troublesome aspects of GraphQL - caching. Being optimized for use in server-side rendered React apps built with Deno, enabling its most powerful features, including optimized caching client-server exchanges & super lightweight client-side caching, all that to support the needs of modern applications!

Features:

  • Performance - GraphQL query abstraction and caching in SSR React projects, improving the performance of your app,
  • Normalized caching - caching, optimizing memory management to keep your site lightweight and fast,
  • Flexibility - Fullstack integration, leveraging client-side, and server-side caching to streamline your caching strategy.

How it works

As already mentioned, the problem Obsidian wants to tackle is caching. When your query for data you will get the response from your GraphQL API containing raw data so it could be stored in your application. If you query for a specific property that is stored in the cache, the Obsidian algorithm will find and return it without querying the API once again. Furthermore, Obsidian will store in cache whole queries and responses to shorten lookup time to a minimum. If the algorithm won't find any matching results in stored data (i.e cache was cleared), Obsidian will fetch them from the server once again.

Getting started

To start using Obsidian we need to install it in both, the server and the client-side:

import { ObsidianRouter } from 'https://deno.land/x/obsidian@v1.0.0/mod.ts';
import { ObsidianWrapper } from 'https://deno.land/x/obsidian@v1.0.0/mod.ts';

The next steps are creating the router, sending `ObsidinaSchema', creating a wrapper, then you are good to make your first query using Obsidian. To get more in-depth information make sure to visit Obsidian docs.

Obsidian GraphQL Query in Deno

Source: obsidian.land

Want to speed up your GraphQL schema development?

GraphQL Editor is a supportive tool for both advanced GraphQL users as well as those taking their first steps with GraphQL APIs. Our all-in-one development environment for GraphQL will help you build, manage & deploy your GraphQL API much faster. Try GraphQL Editor for free!

GraphQL Editor

Discussion

pic
Editor guide