In this tutorial, we will develop a simple coin price list using GraphQL API of Upstash. You can call the application backendless because we will access the database directly from the client (javascript). See the code.


We want to give a use case where you can use the GraphQL API without any backend code. The use case is publicly available read only data for web applications where you need low latency. The data is updated frequently by another backend application, you want your users to see the last updated data. Examples: Leaderboards, news list, blog list, product list, top N items in the homepages.

1 Project Setup:

Create a Next application: npx create-next-app.

Install Apollo GraphQL client: npm i @apollo/client

2 Database Setup

If you do not have one, create a database following this guide. Connect your database via Redis CLI and run:

rpush coins '{ "name" : "Bitcoin", "price": 56819, "image": ""}' '{ "name" : "Ethereum", "price": 2130, "image": ""}' '{ "name" : "Cardano", "price": 1.2, "image": ""}' '{ "name" : "Polkadot", "price": 35.96, "image": ""}' '{ "name" : "Stellar", "price": 0.506, "image": ""}'

3 Code

In the Upstash console, copy the read only access key in your API configuration page (GraphQL Explorer > Configure API). In the _app.js create the Apollo client and replace the your access key as below:

You need to use Read Only Access Key, because the key will be accessible publicly.

import "../styles/globals.css";
import {
} from "@apollo/client";

const link = createHttpLink({
  uri: "",
  headers: {
    Authorization: "Bearer YOUR_ACCESS_TOKEN",
const client = new ApolloClient({
  uri: "",
  cache: new InMemoryCache(),

function MyApp({ Component, pageProps }) {
  return (
    <ApolloProvider client={client}>
      <Component {...pageProps} />{" "}

export default MyApp;

Edit index.js as below:

import Head from "next/head";
import styles from "../styles/Home.module.css";
import { gql, useQuery } from "@apollo/client";
import React from "react";

const GET_COIN_LIST = gql`
  query {
    redisLRange(key: "coins", start: 0, stop: 6)

export default function Home() {
  let coins = [];
  const { loading, error, data } = useQuery(GET_COIN_LIST);

  if (!loading && !error) {
    for (let x of data.redisLRange) {
      let dd = JSON.parse(x);

  return (
    <div className={styles.container}>
        <title>Create Next App</title>
        <link rel="icon" href="/favicon.ico" />

      <main className={styles.main}>
        <h3 className={styles.title}>Coin Price List</h3>

        <div className={styles.grid}>
          <table className={styles.coins}>
              {!loading ? (
      , ind) => (
                  <tr key={ind}>
                      <img src={item.image} width="25" />
                    <td className={styles.price}>${item.price}</td>
              ) : (
                    <img src="/loader.gif" />

      <footer className={styles.footer}>
        <p className={styles.description}>
          <a href=""> Click for the tutorial </a>

4 Run

Run your application locally: npm run dev

5 Live!

Go to http://localhost:3000/ 🎉