A Crypto App built to pracitse GraphQL Federation

Overview

Getting Started

To start this project please first create a .env file in the root of your project with the following:

REACT_APP_ASTRA_TOKEN={your_astra-token}

In your Datastax Astra Dashboard, create a keyspace called 'coins'. Then navigate to your GraphQL playground and make sure you are at the endpoint ending with graphql-admin.

Eg: https://5892dddf-ff9a-4b40-aa31-aa97de1a0966-westeurope.apps.astra.datastax.com/api/graphql-admin

Once there, make sure to add the following to the HTTP Header to authorize access:

{
  "x-cassandra-token": {your_astra-token}
}

And deploy the following Schema:

mutation {
  deploySchema(
    keyspace: "coins"
    schema: """
    type Coin @key @cql_input {
      asset_id: String! @cql_column(partitionKey: true)
      name: String
      category: String @cql_index
      price_usd: Float
    }
    type Mutation {
      insertCoin(coin: CoinInput): Coin
    }
    type Query {
      coinsByAssetIds(
        asset_ids: [String] @cql_where(field: "asset_id", predicate: IN)
      ): [Coin]
      coinsByCategory(
        category: String
      ): [Coin]
    }
    """
  ) {
    version
  }
}

Next, go to the endpoint with your keyspace name:

Eg: https://5892dddf-ff9a-4b40-aa31-aa97de1a0966-westeurope.apps.astra.datastax.com/api/graphql/coins

And create some coins:

mutation {
  c1: insertCoin(
    coin: {
      asset_id: "BTC"
      name: "Bitcoin"
      category: "Crypto"
      price_usd: 30724.60
    }
  ) {
    asset_id
  }
  c2: insertCoin(
    coin: {
      asset_id: "ETH"
      name: "Ethereum"
      category: "Crypto"
      price_usd: 1817.46
    }
  ) {
    asset_id
  }
    c3: insertCoin(
    coin: {
      asset_id: "GBP"
      name: "Great British Pounds"
      category: "Currency"
      price_usd: 1.37
    }
  ) {
    asset_id
  }
}

To run this project please type the following commands:

npm i

This will install all the necessary dependencies.

npm run start-deals

This will start the Deals Service on http://localhost:4001

npm run start-gateway (in a new tab)

This will start the gateway with data from both the Deals Service and DataStax on http://localhost:4000

npm run start (in a new tab)

Runs the app in the development mode.
Open http://localhost:3000 to view it in the browser.

The page will reload if you make edits.
You will also see any lint errors in the console.

To learn React, check out the React documentation.

You might also like...

A lightweight way to cache on graphQL servers

A lightweight way to cache on graphQL servers

cacheflowQL What is cacheflowQL? CacheflowQL is an npm package with complex caching algorithms that provide developers deep insights into their GraphQ

Nov 16, 2022

A template for WebSockets powered Cloudflare Worker project using graphql-ws

🚡 graphql-ws on Cloudflare Workers A template for WebSockets powered Cloudflare Worker project using graphql-ws. The worker serves the following rout

Dec 18, 2022

Unofficial API Documentation for the Axie Infinity's GraphQL Endpoint.

Axie GraphQL Documentation API Documentation for the Axie Infinity GraphQL Endpoint. Customization Guide This site is usings rocketseat. You may refer

Nov 24, 2022

A GraphQL Generator for Mongo and CosmosDB

A GraphQL Generator for Mongo and CosmosDB

A GraphQL Function Starter Kit for Cosmos DB This is a starter kit for rapid development of a GraphQL API using the Mongo driver for Cosmos DB. You cr

Nov 12, 2021

Very easy graphQL example made by Bobby Chao

Very easy graphQL example made by Bobby Chao. The folder has been organized, the module has been split, and it can be directly used as a development scratch. It using graphQL + node.js + express, and MySQL as datasource.

Sep 18, 2022

Graphql & Apollo

Getting Started with Create React App This project was bootstrapped with Create React App. Available Scripts After fetch the project, please install n

Dec 21, 2021

GraphQL API Playground with cascade-like operations

modif ( 🍖 👉 🥪 ) modif is a small GraphQL API with transform capabilities. It takes a string input and outputs a string. Always. TL;DR Go play with

Jan 4, 2022

Starter template for NestJS 😻 includes GraphQL with Prisma Client, Passport-JWT authentication, Swagger Api and Docker

Instructions Starter template for 😻 NestJS and Prisma. Checkout NestJS Prisma Schematics to automatically add Prisma support to your Nest application

Jan 4, 2023

graphql-codegen plugin to generate type-safe, easy-to use hooks for Flutter

graphql-codegen-flutter-artemis-hooks This is graphql-codegen plugin to generate type-safe, easy-to use Flutter artemis hooks. For further detail, see

Jan 2, 2023
Comments
  • gateway.js

    gateway.js

    Hello, thank you for all your hard work and great example unfortunately upon building the same project with your video help at youtube. i am facing the following error when running: npm run start-gateway.

    (node:59608) UnhandledPromiseRejectionWarning: Error: A valid schema couldn't be composed. The following composition errors were found: [@atomic] -> Custom directives must be implemented in every service. The following services do not implement the @atomic directive: deals.

    opened by SoheilJahangiri 0
Owner
Ania Kubow
I make #JavaScriptGames for fun!
Ania Kubow
curl for GraphQL with autocomplete, subscriptions and GraphiQL. Also a dead-simple universal javascript GraphQL client.

graphqurl graphqurl is a curl like CLI for GraphQL. It's features include: CLI for making GraphQL queries. It also provisions queries with autocomplet

Hasura 3.2k Jan 3, 2023
GraphQL Fastify Server is an implementation of GraphQL.

GraphQL Fastify Server Installation Usage Using cache Middlewares Liveness & Readiness Contributing License Installation npm install --save graphql-fa

Rui Silva 33 Dec 19, 2022
Basic Dapp showing how a React Dapp can connect to Cronos using MetaMask and Crypto.com Defi Wallet

cronos-dapp-basic Basic Dapp showing how a React Dapp can connect to Cronos using MetaMask and Crypto.com Defi Wallet You need to have node version 14

Acclrate 1 Dec 31, 2021
Ecommerce-backend-nestjs - Ecommerce app with Nestjs + Prisma ORM + GraphQL + SQLite

ECOMMERCE BACKEND NESTJS APP Nestjs + Prisma ORM + GraphQL + SQLite USER Create Account Login Product Create Product Get Products Get Product Search P

Rui Paulo Calei 5 Apr 6, 2022
Execute one command (or mount one Node.js middleware) and get an instant high-performance GraphQL API for your PostgreSQL database!

PostGraphile Instant lightning-fast GraphQL API backed primarily by your PostgreSQL database. Highly customisable and extensible thanks to incredibly

Graphile 11.7k Jan 4, 2023
Conjure SQL from GraphQL queries 🧙🔮✨

Sqlmancer Conjure SQL from your GraphQL queries ?? ?? ✨ ⚠️ This project is currently on hiatus. I am hoping to resume working on Sqlmancer once I have

Daniel Rearden 132 Oct 30, 2022
Application made to show the basic concepts of GraphQL with Apollo Server

graphql-insta-example Application made to show the basic concepts of GraphQL with Apollo Server. Getting Started Run npm install Run npm run dev Go to

Ana Julia Bittencourt 26 Aug 26, 2022
Workshop to illustrate how to use GraphQL

?? Netflix Clone using Astra DB and GraphQL 50 minutes, Intermediate, Start Building A simple ReactJS Netflix homepage clone running on Astra DB that

DataStax Developers 606 Jan 4, 2023
Learn GraphQL PIAIC CNC Class code

GraphQL using React! Steps (for 01 - react-graphql) Generate and copy Access Token from Github Personal Acess Token Create .env file in project folder

Yousuf Qutubuddin 71 Jan 2, 2023
Código desenvolvido na mentoria do Hiring Coders utilizando Express e GraphQL

hiringcoders-graphql Código desenvolvido na mentoria do Hiring Coders utilizando Express e GraphQL Contribuições A ideia do repositório é continuar si

Daniel Mitre 37 Dec 29, 2022