Forem

Cover image for Obsidian - GraphQL caching client & server module for Deno
Tomek Poniatowicz for GraphQL Editor

Posted on

Obsidian - GraphQL caching client & server module for Deno

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';
Enter fullscreen mode Exit fullscreen mode
import { ObsidianWrapper } from 'https://deno.land/x/obsidian@v1.0.0/mod.ts';
Enter fullscreen mode Exit fullscreen mode

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

Image of Timescale

🚀 pgai Vectorizer: SQLAlchemy and LiteLLM Make Vector Search Simple

We built pgai Vectorizer to simplify embedding management for AI applications—without needing a separate database or complex infrastructure. Since launch, developers have created over 3,000 vectorizers on Timescale Cloud, with many more self-hosted.

Read more

Top comments (0)

đź‘‹ Kindness is contagious

Immerse yourself in a wealth of knowledge with this piece, supported by the inclusive DEV Community—every developer, no matter where they are in their journey, is invited to contribute to our collective wisdom.

A simple “thank you” goes a long way—express your gratitude below in the comments!

Gathering insights enriches our journey on DEV and fortifies our community ties. Did you find this article valuable? Taking a moment to thank the author can have a significant impact.

Okay