• Stars
    star
    115
  • Rank 305,916 (Top 7 %)
  • Language
    JavaScript
  • Created over 3 years ago
  • Updated over 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A Netflix Clone built using React GraphQL and DataStax, exploring Pagination and Slicing

🎓 Netflix Clone using DataStax and GraphQL

This project was bootstrapped with Create React App.

Table of content

  1. Prerequisites
  2. Create Astra Instance
  3. Create a security token
  4. Create table genre with GraphQL
  5. Insert data in genre with GraphQL
  6. Retrieve values of genre table
  7. Create movie table
  8. Insert values in movie table
  9. Retrieve values from movie table
  10. Start the Project

1. Prerequisites

  1. Make sure to install Netlify CLI
npm install netlify-cli -g

2. Create Astra Instance

When creating your instance use the promotion code ANIA200 to get 200$ of free credit allowing you about 30 million writes + 30 Million reads + 50GB a month of monthly storage!!

ASTRA is the simplest way to run Cassandra with zero operations at all - just push the button and get your cluster. No credit card required, $25.00 USD credit every month, roughly 5M writes, 30M reads, 40GB storage monthly - sufficient to run small production workloads.

Register (if needed) and Sign In to Astra https://astra.datastax.com: You can use your Github, Google accounts or register with an email.

Make sure to chose a password with minimum 8 characters, containing upper and lowercase letters, at least one number and special character

Create a "pay as you go" plan

Follow this guide, to set up a pay as you go database with a free $25 monthly credit.

  • Select the pay as you go option: Includes $25 monthly credit - no credit card needed to set up.

You will find below which values to enter for each field.

  • For the database name - code_with_ania_kubow. While Astra allows you to fill in these fields with values of your own choosing, please follow our recommendations to ensure the application runs properly.

  • For the keyspace name - netflix. It's really important that you use the name "free" for the code to work.

You can technically use whatever you want and update the code to reflect the keyspace. This is really to get you on a happy path for the first run.

  • For provider and region: Choose and provider (either GCP or AWS). Region is where your database will reside physically (choose one close to you or your users).

  • Create the database. Review all the fields to make sure they are as shown, and click the Create Database button.

You will see your new database pending in the Dashboard.

my-pic

The status will change to Active when the database is ready, this will only take 2-3 minutes. You will also receive an email when it is ready.

🏠 Back to Table of Contents

3. Create a security token

Create a token for your app to use in the settings screen

Copy the token value (eg AstraCS:KDfdKeNREyWQvDpDrBqwBsUB:ec80667c....) in your clipboard and save the CSV this value would not be provided afterward.

👁️ Expected output image

🏠 Back to Table of Contents

4. Create table genre with GraphQL

Open GraphQL Playground by

  1. Click on your active database
  2. Click Connect TAB
  3. Click GRAPHQL API
  4. Clik link to you playground.

as show on the picture below image

Populate HTTP HEADER variable x-cassandra-token on the bottom of the page with your token as shown below

image

In GraphQL Playground, create a table with the following mutation, making sure to replace netflix:

mutation {
  reference_list: createTable(
    keyspaceName:"netflix",
    tableName:"reference_list",
    ifNotExists:true
    partitionKeys: [ 
      { name: "label", type: {basic: TEXT} }
    ]
    clusteringKeys: [
      { name: "value", type: {basic: TEXT}, order: "ASC" }
    ]
  )
}

🏠 Back to Table of Contents

5. Insert data in the Table with GraphQL

In graphQL playground, change tab to now use graphql. Edit the end of the URl to change from system to the name of your keyspace: netflix

Populate HTTP HEADER variable x-cassandra-token on the bottom of the page with your token as shown below (again !! yes this is not the same tab)

image

In GraphQL Playground,populate the reference_list table with the following values:

mutation insertGenres {
  action: insertreference_list(value: {label:"genre", value:"Action"}) {
    value{value}
  }
  anime: insertreference_list(value: {label:"genre", value:"Anime"}) {
     value{value}
  }
  award: insertreference_list(value: {label:"genre", value:"Award-Winning"}) {
     value{value}
  }
  children: insertreference_list(value: {label:"genre", value:"Children & Family"}) {
     value{value}
  }
  comedies: insertreference_list(value: {label:"genre", value:"Comedies"}) {
     value{value}
  }
  documentaries: insertreference_list(value: {label:"genre", value:"Documentaries"}) {
     value{value}
  }
  drama: insertreference_list(value: {label:"genre", value:"Dramas"}) {
     value{value}
  }
  fantasy: insertreference_list(value: {label:"genre", value:"Fantasy"}) {
     value{value}
  }
  french: insertreference_list(value: {label:"genre", value:"French"}) {
     value{value}
  }
  horror: insertreference_list(value: {label:"genre", value:"Horror"}) {
     value{value}
  }
  independent: insertreference_list(value: {label:"genre", value:"Independent"}) {
     value{value}
  }
  music: insertreference_list(value: {label:"genre", value:"Music"}) {
     value{value}
  }
  romance: insertreference_list(value: {label:"genre", value:"Romance"}) {
     value{value}
  }
  scifi: insertreference_list(value: {label:"genre", value:"Sci-Fi"}) {
     value{value}
  }
  thriller: insertreference_list(value: {label:"genre", value:"Thriller"}) {
     value{value}
  }  
}

🏠 Back to Table of Contents

6. Retrieving list of values

In GraphQL Playground, not changing tab (yeah) list values from the table with the following command.

query getAllGenre {
    reference_list (value: {label:"genre"}) {
      values {
      	value
      }
    }
}

👁️ Expected output image

🏠 Back to Table of Contents

7. Creating a Movies Table

Move to tab GRAPHQL-SCHEMA, everything should be set, use the following mutation to create a new table:

mutation {
  movies_by_genre: createTable(
    keyspaceName:"netflix",
    tableName:"movies_by_genre",
    ifNotExists: true,
    partitionKeys: [
      { name: "genre", type: {basic: TEXT} }
    ]
    clusteringKeys: [ 
      { name: "year", type: {basic: INT}, order: "DESC" },
      { name: "title", type: {basic: TEXT}, order: "ASC" }
    ]
    values: [
      { name: "synopsis", type: {basic: TEXT} },
      { name: "duration", type: {basic: INT} },
      { name: "thumbnail", type: {basic: TEXT} }
    ]
  )
}

👁️ Expected output image

🏠 Back to Table of Contents

8. Insert Values in Movie table

Move to tab GRAPHQL, everything should be set, use the following mutation to populate movies table:

mutation insertMovies {
  inception: insertmovies_by_genre(
    value: { 
      genre:"Sci-Fi", 
      year:2010,
      title:"Inception",
      synopsis:"Cobb steals information from his targets by entering their dreams.",
      duration:121,
      thumbnail:"https://i.imgur.com/RPa4UdO.mp4"}) {
    value{title}
    }
  
  prometheus: insertmovies_by_genre(value: { 
      genre:"Sci-Fi", 
      year:2012,
      title:"Prometheus",
      synopsis:"After a clue to mankind's origins is discovered, explorers are sent to the darkest corner of the universe.",
      duration:134,
      thumbnail:"https://i.imgur.com/L8k6Bau.mp4"}) {
    value{title}
   }
  
  aliens: insertmovies_by_genre(value: { 
      genre:"Sci-Fi", 
      year:1986,
      title:"Aliens",
      synopsis:"Ellen Ripley is sent back to the planet LV-426 to establish contact with a terraforming colony.",
      duration:134,
      thumbnail:"https://i.imgur.com/QvkrnyZ.mp4"}) {
    value{title}
   }
  
   bladeRunner: insertmovies_by_genre(value: { 
      genre:"Sci-Fi", 
      year:1982,
      title:"Blade Runner",
      synopsis:"Young Blade Runner K's discovery of a long-buried secret leads him to track down former Blade Runner Rick Deckard.",
      duration:145,
      thumbnail:"https://i.imgur.com/xhhvmj1.mp4"}) {
    value{title}
   }
 }

ℹ️ To get more movie data check the files in the data folder.

👁️ Expected output image

🏠 Back to Table of Contents

9. Retrieve values from Movie tables

In GraphQL Playground, not changing tab (yeah) list values from the table with the following command.

query getMovieAction {
    movies_by_genre (
      value: {genre:"Sci-Fi"},
       orderBy: [year_DESC]) {
      values {
      	year,
        title,
        duration,
        synopsis,
        thumbnail
      }
    }
}

👁️ Expected output image

10. Start the project

Create .env file

ASTRA_DB_APPLICATION_TOKEN={ your_token }
ASTRA_GRAPHQL_ENDPOINT={ your_endpoint }

👩‍💻 Install all the packages

npm install

👩‍💻 Inject all the secret variables and runthe project using

netlify dev

note: (make sure you have installed the netlify command line interface. You can do so by running: npm install netlify-cli -g)

TADA

image

More Repositories

1

memory-game

JavaScript, HTML and CSS grid-based game
JavaScript
396
star
2

Tetris-Basic

This is a simple no nonsense version of Tetris that has no styling
JavaScript
262
star
3

mario

A game of Mario using JavaScript and Kaboom.js
JavaScript
252
star
4

Tetris

A vanilla javascript game
JavaScript
202
star
5

candy-crush

A vanilla JavaScript Game inspired by Candy Crush
JavaScript
171
star
6

Nokia3310-Snake

A vanilla JavaScript game with tutorial
JavaScript
164
star
7

climate-change-live-api

A Demo to show how to build your own API and host in on RapidAPI
JavaScript
163
star
8

space-invaders

A vanilla JavaScript game with HTML and CSS
JavaScript
160
star
9

battleships

javaScript HTML and CSS
JavaScript
138
star
10

nodejs-webscraper

Demo for showing how to get backend data to the frontend
JavaScript
129
star
11

minesweeper

A simplified game of minesweeper using vanilla JavaScript
JavaScript
121
star
12

burger-api

My Burger Api
JavaScript
119
star
13

flappy-bird

A game of Flappy Bird made in pure JavaScript, HTML and CSS
JavaScript
110
star
14

whac-a-mole

Vanilla JavaScript game
JavaScript
110
star
15

pac-man

Vanilla javaScript Game with HTML and CSS
JavaScript
107
star
16

connect-four

A Pure JavaScript grid-based game
JavaScript
106
star
17

candy-crush-reactjs

A minimal game of Candy Crush in React
JavaScript
97
star
18

portfolio-website

Portfolio website
JavaScript
93
star
19

Frogger

A retro grid-based game in vanilla JavaScript, HTML and CSS
JavaScript
90
star
20

stargate-tik-tok

JavaScript
85
star
21

Doodle-Jump

Doodle Jump clone in JavaScript, HTML and CSS
JavaScript
83
star
22

airbnb-sanity-backend

The backend for our Airbnb App, built using Sanity.io.
JavaScript
80
star
23

tinder-clone

A Tinder Clone for educational purposes
JavaScript
76
star
24

zelda

A game of Zelda in JavaScript using Kaboom.js
JavaScript
73
star
25

responsive-portfolio

HTML
72
star
26

wordle-javascript

A Game of Wordle with the benefit of 2x API from RapidAPI
JavaScript
65
star
27

rock-paper-scissors-x3

3 ways to code Rock Paper Scissors in JavaScript
JavaScript
63
star
28

airbnb-sanity-frontend

This is the frontend for my AirBnb Project built using Next.js and Sanity.io
JavaScript
63
star
29

2048

A game of 2048 in vanilla javaScript, HTML and CSS
JavaScript
58
star
30

chrome-trex-game

A game made in pure javaScript HTML and CSS
JavaScript
54
star
31

disney-clone-graphcms

A demo to show how to use graphcms
JavaScript
54
star
32

flappy-birds-react-native

A game of flappy birds in react native
JavaScript
51
star
33

crypto-dashboard-react

A Crypto Dashboard built in React and Nodejs using RapidAPI
JavaScript
49
star
34

breakout

A game of breakout in HTML, CSS and JavaScript
JavaScript
48
star
35

portfolio-with-animations

A Portfolio with Animations in JavaScript
JavaScript
48
star
36

monday-crm-clone

A Clone of the Monday CRM System for tutorial purposes
JavaScript
47
star
37

light-dark-mode-portfolio

A light and dark theme portfolio in HTML, CSS and JS
CSS
40
star
38

Project-04

Business Bank Account Dashboard using React and Django
JavaScript
39
star
39

typewriter

typewriter effect in JavaScript
JavaScript
38
star
40

graphQL-federation-crypto

A Crypto App built to pracitse GraphQL Federation
JavaScript
36
star
41

distance-matrix-routing-with-tom-tom-api

Distance Matrix Routing App with Tom Tom API
JavaScript
31
star
42

javascript-playing-piano

A Playing Piano built in JavaScript
HTML
30
star
43

flight-widget-vanilla-javascript

A Flight widget made in vanilla JavaScript just for fun!
JavaScript
29
star
44

google-translate-clone

A Google Translate Clone built for tutorial purposes
JavaScript
28
star
45

tic-tac-toe

Introduction to JavaScript with Tic-Tac-Toe
JavaScript
27
star
46

deployed-todo-app

JavaScript
27
star
47

trivia-app

A trivia App built in vanilla JavaScript
JavaScript
26
star
48

twitch-messenger-clone

A Messenger App built in React and Node.js using getStream.io
JavaScript
26
star
49

regex-openai

The Code for the iframe
HTML
25
star
50

Advanced-React-and-Redux-2019

Detailed project on advanced React and Redux concepts - Authentication, Testing, Middlewares, HOC's, and Deployment
JavaScript
25
star
51

foundation-app-subgraph

Supporting Code for Querying Data on the Blockchain Tutorial
TypeScript
24
star
52

linktree-clone-css-js

Build a Linktree Clone! (super simple!) HTML + CSS (+ JS optional)
HTML
23
star
53

mocha-test

Boilerplate for Mocha tests
HTML
23
star
54

Predictive-Text-Search-Bar

JavaScript
23
star
55

pacman-AI-live

live game of pacman
JavaScript
22
star
56

birthday-countdown

A Birtday countdown in JavaScript
JavaScript
21
star
57

candy-crush-reactjs-with-game-state

A game of Candy Crush in React where you can save game state
JavaScript
21
star
58

opentelemetry-movies-microservices

JavaScript
19
star
59

rock-paper-scissors-react

Rock Paper Scissors in React
JavaScript
19
star
60

financial-article-classifier-ai-model

19
star
61

moving-wave-portfolio

A Portfolio built in HTML and CSS with a moving wave SVG and working submit from
HTML
19
star
62

responsive-gallery-website

HTML
18
star
63

Google-Home-Chatbot

Voice and Chatbot for Google Home
JavaScript
18
star
64

jeopardy-javascript

A game of Jeopardy in javaScript
HTML
18
star
65

opentelemetry-tracing

Introduction to Tracing
JavaScript
18
star
66

sudoku-solver

A project to learn hw to use APIs in JavaScript and NodeJS
JavaScript
17
star
67

javascriptgames

HTML
16
star
68

hashing-passwords-template-app

A React form that will hash your passwords and send them to a database
JavaScript
16
star
69

zip-food-delivery-app

16
star
70

whack-a-mole-react-native

We build Whack-a-mole in react native
JavaScript
15
star
71

zelda-inventory

A Project to practise Database use
JavaScript
15
star
72

hotel-app

A Project to Demo using a GraphQL API with Serverless Functions
JavaScript
15
star
73

react-nodejs-database-flight-widget

JavaScript
14
star
74

buzzfeed-clone-typescript-database

Build a Buzzfeed Clone in TypeScript + REST API Database + Node.js!
TypeScript
14
star
75

serverless-database

How to use a serverless database with DataStax and Netlify Functions
JavaScript
14
star
76

word-association-game

A React Project built using RapidAPI
JavaScript
13
star
77

pacman-with-voice-AI-final

Final code for tutorial pacan-with-voice-AI
JavaScript
13
star
78

jump-slide

A simple function for jumping and sliding in games
JavaScript
13
star
79

word-association-vanilla-javascript

A Word Association Game made in vanilla JavaScript just for fun!
JavaScript
13
star
80

web-monetization-demo

A demo to show users how to use web monetization on their websites
HTML
13
star
81

my-javascript-action

JavaScript
12
star
82

travel-blog

A travel blog built using React and Sanity.io
JavaScript
12
star
83

communications-dashboard

12
star
84

pac-man-move-closer-logic

Making Blinky chase PacMan wherever he is on the board in vanilla javaScript
JavaScript
12
star
85

show-more-feature

Show More Feature in Vanilla JavaScript, HTML and CSS
HTML
11
star
86

space-invaders-kaboom.js

A game of Space Invaders using Kaboom.js
JavaScript
10
star
87

pacman-with-voice-AI

pacman in JS for voice AI tutorial
JavaScript
10
star
88

zelda-kaboom.js

Zelda using Kaboom.js
JavaScript
10
star
89

buzzfeed-clone-react

Build Buzzfeed quiz in React + JSON Server!
JavaScript
10
star
90

React-app-setup

Packages and code for setting up a React App
JavaScript
10
star
91

beer-generator-javascript

Random beer Generator using vanilla JavaScript API fetch
CSS
9
star
92

next-landing-page

CSS
8
star
93

mobee-psql-data

Demo data for the Mobee App
8
star
94

to-do-app

JavaScript
8
star
95

wdi-fundamentals-memorygame

Pre-course prep work using HTML, CSS and JS
CSS
8
star
96

burger-app

For a Document API and ExpressJS Demo
JavaScript
7
star
97

video-app-frontend

A demo to show how to use Structured Content
JavaScript
7
star
98

javascript-nodejs-api-flight-widget

JavaScript
7
star
99

eslintrc-example

AN example of a .eslintrc file
7
star
100

video-app-backend

A Demo of how to use Structured Content
JavaScript
6
star