Your data, already there.

Glacier predicts what your app will need next and pre-warms it at the edge — so the data is waiting before the user even asks.

glacier.config.js
package.json
import { Glacier } from '@glacier/core'
export const glacier = new Glacier({
strategy: 'predictive',
edge: true,
ttl: '5m',
})

Introduction

Getting started

Learn how to add Glacier to your app and start serving data before your users even ask for it.

Installation

Step-by-step guide to adding Glacier to a new or existing project.

Core concepts

How predictive caching works and the ideas behind it.

Guides

Use Glacier with React, your favorite framework, and your tooling.

API reference

Every method, option, and event, documented in detail.

Glacier is a predictive-caching SDK for the web. Instead of waiting for a request to come in and then fetching data, Glacier learns the paths your users take through your app, predicts what they'll need next, and pre-warms that data at the edge. By the time the request arrives, the answer is already there.


Quick start

The fastest way to feel what Glacier does is to drop it in front of an existing data fetch. Install the package, create a client, and wrap a query.

Installing dependencies

Glacier ships as a single package with zero required configuration. Install it with your package manager of choice.

npm install @glacier/core

If you're using React, you'll also want the bindings, which give you hooks and a provider:

npm install @glacier/react

You should know!

Glacier works without any backend changes. It sits between your app and your existing data sources — your API, your database client, or a third-party SDK — and warms their responses ahead of time.

Configuring the client

Create a single Glacier client and share it across your app. The defaults are sensible; the most common thing to change is the time-to-live and whether prediction runs at the edge.

// glacier.config.js
import { Glacier } from '@glacier/core'

export const glacier = new Glacier({
  strategy: 'predictive',
  edge: true,
  ttl: '5m',
})

Basic usage

Once you have a client, you register the queries you want Glacier to manage. Glacier observes how they're used and starts prefetching the ones it expects next.

Your first prediction

Wrap any async function and Glacier will cache it, track access patterns, and predictively warm it.

const getUser = glacier.predict('user', (id) => api.fetchUser(id))

// Later — this resolves instantly if Glacier already warmed it
const user = await getUser(currentUserId)

Invalidating data

When data changes, tell Glacier so it can refresh — or drop — the relevant entries. Invalidation is keyed, so you only blow away what actually changed.

await glacier.invalidate('user', currentUserId)

Syncing across the edge

In a multi-region deployment, sync() keeps warmed data consistent across edge nodes so a user who hops regions still gets a warm cache.

await glacier.sync()

Getting help

Glacier is open source and actively developed. If you hit something confusing or think you've found a bug, we'd love to hear about it.

Submit an issue

The fastest way to get a fix is a small, reproducible example. Open an issue on GitHub with the version of Glacier you're running and the steps to reproduce, and we'll take a look.

Join the community

Most day-to-day questions get answered fastest in the community chat, where other Glacier users and the maintainers hang out. Come say hello, share what you're building, and help us make the docs better.