Coder Social home page Coder Social logo

stargate-typescript's Introduction

Stargate TypeScript/Next.js/Apollo sample application

This is a Next.js project bootstrapped with create-next-app.

This is a sample application which shows how to query a Cassandra cluster using GraphQL, Next.js and Apollo Client.

Getting Started

Setup Stargate and your environment

Start stargate in development mode, using the provided docker-compose.yml file:

docker-compose up

Then, follow the instruction in the official Stargate documentation so the approprate Cassandra library keyspace and with the authors and books tables are created:

https://stargate.io/docs/stargate/0.1/quickstart/quick_start-graphql.html

Once you're set, generate a secret token with:

bin/create-token.sh

Once generated, copy/paste the token in a .env.local file:

NEXT_PUBLIC_X_CASSANDRA_TOKEN=your-secret-token-here

This token will then be used by the Apollo Client http-link when querying Stargate GraphQL endpoint for the library.

Run the development server

We use GraphQL Code Generator and follow the approach detailed here: https://formidable.com/blog/2019/strong-typing/

npm run dev
# or
yarn dev

This will start next.js in dev mode and regenerate TypeScript types on file change.

Open http://localhost:3000 with your browser to see the result, and start adding books to the library stored in Cassandra.

Happy tinkering!

stargate-typescript's People

Contributors

jbmusso avatar beccam avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.