Code Monkey home page Code Monkey logo

react-native-appsync-s3's Introduction

React Native AppSync S3

Final

This app allows the user to do the following:

  • Sign Up/In to the platform.
  • Access device library using Expo.
  • Upload pictures to AWS S3.
  • Store the pictures records in Amazon DynamoDB.
  • Display the pictures in the platform.

Prerequisites

Configuring the project

  1. Clone this repo to your local machine.
git clone https://github.com/yhenni1989/react-native-appsync-s3.git

cd react-native-appsync-s3
  1. Add AWS Amplify dependencies to your project.
yarn add aws-amplify aws-amplify-react-native

# or

npm install aws-amplify aws-amplify-react-native
  1. Initialise the AWS Amplify project.
amplify init

Follow the same instructions as below.

init

  1. Configure an Amazon Cognito User Pool to store users credentials.
amplify add auth

# When prompt, choose: Yes, use the default configuration.
  1. Add an Amazon S3 bucket to store pictures.
amplify add storage

# Choose: Content (Images, audio, video, etc.)
# Give access to only authenticated users.
# Give users read/write acces.
  1. Add the AWS AppSync API to use GraphQL and store data in DynammoDB.
amplify add api

# Choose GraphQL as the API service. 
# Choose an authorization type for the API: Amazon Cognito User Pool
# Do you have an annotated GraphQL schema? Yes
# Provide your schema file path: src/graphQL/schema.graphql
  1. Deploy your project to the AWS.
amplify push

cloudformation

Do you want to generate code for your newly created GraphQL API: No.

The AWS Amplify CLI will create an Amazon Cognito User Pool and Identity Pool, an Amazon S3 bucket to store each users photos and an AWS AppSync GraphQL API that uses Amazon DynamoDB to store data.

Running the application

  1. Install client dependencies.
yarn

# or

npm install
  1. You will need your AWS IAM credentials before running the application.
  • Copy your access and secret keys in the src/myKeys.js file of your project.
const keys = {
 accessKey: 'blablabla',
 secretKey: 'blablabla',
}
export default keys;
  • Save changes.
  1. Launch the React Native app in your simulator from the terminal under your project directory.
expo start --ios

# or

expo start --android
  1. Create a new user.
  • The app uses the Higher Order Component withAuthenticator (HOC) from AWS Amplify to perform the authentication flow: sign up, confirm sign up and sign in users.
  1. Add and display pictures.
  • If the application runs successfully you should be able to press the add button, allow access to device library, and select a picture from your device. This will upload the picture to S3 then make a GraphQL call to enter the record into DynamoDB.

  • You can then press the refresh button to display the picture on the screen.

Contribute

  • This project needs lots of improvement. Help me grow and improve it ๐Ÿ’ช.

react-native-appsync-s3's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  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.