Coder Social home page Coder Social logo

hmisonne / amplify_groceryapp Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 4.0 6.59 MB

Mobile Application for Grocery Shoppers using React Native, AppSync, GraphQL API.

JavaScript 78.64% TypeScript 21.36%
aws-amplify-react-native amplifydatastore dynamodb appsync-graphql-api appsync javascript react-native react-redux

amplify_groceryapp's Introduction

ListBee - Grocery List App

This project was made for all the grocery shoppers that needs a tool to organize their shopping list and share it among friends.

๐Ÿ›  Built with React Native, Expo, GraphQL, AWS Amplify, Amplify DataStore, AWS AppSync

Platform Compatibility

Android iOS
โœ”๏ธ โœ”๏ธ
Play Store Listing App Store Listing

Screenshots

Features

  • ๐Ÿ‘ฎโ€ Authentication
  • ๐Ÿ”ฅ Serverless back end
  • ๐Ÿš€ GraphQL
  • ๐Ÿ‘ป Offline and delta sync capabilities

Architecture Overview

To deploy the backend of this app, I chose to use Amplify.

AWS Amplify is an end-to-end solution that enables mobile and front-end web developers to build and deploy secure, scalable full stack applications, powered by AWS.

With Amplify, I was able to add Authentification to my app with AWS Cognito, build a GraphQL API that interacts with DynamoDB and add DataStore to offer offline synchronization.

Here is an overview of the architecture deployed to allow offline synchronization: Architecture

This architecture allowed me to only interact with the DataStore API using standard JavaScript function invocations.

GraphQL Schema

This app has 3 models Product, GroceryList and User.

  • A user can add to his/her dashboard multiple grocery lists which can be shared among multiple users.
  • After creating a new grocery list, products can be added to a specific list. This is a one-to-many relationship.
type Product @model 
@key(name: "productByGroceryList", fields: ["groceryListID"])
{
  id: ID!
  groceryListID: ID!
  name: String!
  checked: Boolean!
  unit: String!
  quantity: Int!
  category: String!
  toBuy: Boolean
}

type GroceryList @model {
  id: ID!
  name: String!
  description: String
  products: [Product] @connection(keyName: "productByGroceryList", fields: ["id"])
  shoppers: [String]
}

type User @model 
@auth(rules: [{ allow: owner }])
{
  id: ID!
  sub: String!
  username: String
  groceryLists: [String]
}

Deploy the App

Prerequisites

In order to run this app, make sure the following dependencies are installed in your computer:

Deploy the back end

  1. Clone the repo & install the dependencies
~ git clone https://github.com/hmisonne/Amplify_GroceryApp.git
~ cd Amplify_GroceryApp
~ npm install
  1. Initialize the Amplify project

Run the following commands and make sure you have access to an AWS account:

~ amplify init
? Enter a name for the environment: dev (or whatever you would like to call this env)
? Choose your default editor: <YOUR_EDITOR_OF_CHOICE>
? Do you want to use an AWS profile? Y
  1. Deploy the backend to your AWS account
~ amplify push
? Are you sure you want to continue? Y
? Do you want to generate code for your newly created GraphQL API? N
> We already have the GraphQL code generated for this project, so generating it here is not necessary.

Update the API and models

  1. Update the amplify project
~ amplify update api
~ amplify push
  1. Update the DataStore
~ npm run amplify-modelgen

Run the front end on your local machine

Start the app

~ npm start

Current limitations:

This rule limit which individuals or groups should have access to create, read, update, or delete data on your types by specifying an @auth directive

To allow users to share multiple lists with multiple users, I am using Selective Sync to prevent the DataStore from downloading the entire content of the cloud database and only get a subset of the data by defining a predicate. This predicates, in my case is the list of grocery list id that is stored per user under 'groceryLists'.

Resources

amplify_groceryapp's People

Contributors

hmisonne avatar

Stargazers

 avatar

Watchers

 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.