Giter Club home page Giter Club logo

amplify-datastore-demo's Introduction

AWS Amplify DataStore Demo

Instructions

  1. Install the CLI tools.
yarn global add create-react-app
yarn global add @aws-amplify/cli
yarn global add amplify-app
  1. Setup new React project.
create-react-app amplify-datastore-app
cd amplify-datastore-app
code .

yarn start
# Then open another terminal

git init
git add -A
git commit -a -m 'Setup new React project.'

# Open http://localhost:3000
  1. Add Amplify DataStore to the project.
amplify-app
yarn add @aws-amplify/core @aws-amplify/datastore semantic-ui-css

git add -A
git commit -a -m 'Add Amplify DataStore to the project.'
  1. Add GraphQL schema and then generate the model(s).
curl -o amplify/backend/api/amplifyDatasource/schema.graphql \
  https://raw.githubusercontent.com/aonz/amplify-datastore-demo/master/schema.graphql

yarn amplify-modelgen

git add -A
git commit -a -m 'Add GraphQL schema and then generate the model(s).'
  1. Use Amplify DataStore in the local mode.
curl -o src/App.js \
  https://raw.githubusercontent.com/aonz/amplify-datastore-demo/master/App.js
curl -o src/App.css \
  https://raw.githubusercontent.com/aonz/amplify-datastore-demo/master/App.css

git add -A
git commit -a -m 'Use Amplify DataStore in the local mode.'

# Test the local version.
  1. Deploy the backend on AWS.
yarn amplify-push
# Will take about 5 mins. 

# Uncomment 3 lines below in src/App.js
# // import Amplify from '@aws-amplify/core';
# // import awsConfig from './aws-exports';
# // Amplify.configure(awsConfig);

git add -A
git commit -a -m 'Deploy the backend on AWS.'

# Test the online version with the backend on AWS.
# - Sync with multiple clients.
# - Online/offline sync.
  1. Deploy the frontend on AWS.
aws codecommit create-repository --repository-name amplify-datastore-app \
  --repository-description 'AWS Amplify DataStore App'
git remote add origin \
  ssh://git-codecommit.ap-southeast-1.amazonaws.com/v1/repos/amplify-datastore-app
git push --set-upstream origin master

amplify add hosting
# Choose `Hosting with Amplify Console` and then `Continuous deployment`
# Will take about 5 mins. 

git add -A
git commit -a -m 'Deploy the frontend on AWS.'

# Test the version with both the frontend and backend on AWS.
  1. Cleanup
amplify delete
aws codecommit delete-repository --repository-name amplify-datastore-app

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.