News
AWS Launches One-Click React Native Starter Project
Now available on GitHub is the Amazon Web Services (AWS) "Mobile React Native Starter App," giving the rapidly evolving React Native ecosystem a new, simplified entry point.
React Native is a young but growing open source technology for native iOS and Android app development that's based on JavaScript, following a "learn once, write anywhere" philosophy instead of the elusive, one-size-fits-all, cross-platform approach defined by "write once, run anywhere."
The bootstrap project provides all the context and support for a "Pet Tracker" app, such as an automatically provisioned infrastructure for serverless computing (using AWS Lambda), authorization, user registration, image storage, access to relevant APIs, database operations and more.
A blog post this week provided more details on how that functionality is provided. "The project contains a starter application that can be run with a single click, using the Deploy from GitHub button capabilities of AWS Mobile Hub," AWS said.
"After deployment finishes, the starter can be run locally using npm or yarn on either iOS or Android. The project demonstrates user sign-up and sign-in flows along with MFA [multifactor authentication] as a 'Pet Tracker' application, allowing you to upload pictures of your pets along with some data (name, age, breed, and gender). The pictures are stored in an S3 bucket. The bucket can only be accessed by the user. Similarly, the records corresponding to these pictures are stored in an Amazon DynamoDB table on a per-user basis as well. This is protected by a serverless infrastructure that uses Amazon API Gateway and AWS Lambda."
Developers interested in tackling the starter project must have an AWS account, NodeJS with npm and the React Native CLI (command-line-tool), while the optional AWS CLI and Watchman file-watching service could come in handy, too.
"In addition to the starter application, which you can modify to fit your needs, the project contains several Higher Order Components (HOCs) that you can use in your application," AWS said. "For instance, there is a WithAuth HOC that you can use to add just the sign-up, sign-in, and MFA portions of the project to your application. Similarly, there are HOCs for secure API and storage access as well."
While all the moving parts of a full-fledged cloud application can seem daunting to set up to many developers, AWS said that upon importing the project, it automatically configures:
- Amazon Cognito User Pools and Federated Identities
- Amazon API Gateway, AWS Lambda, and Amazon DynamoDB
- Amazon S3, including bucket policies and folder structures for private and public content
- IAM roles and policy for the Lambda execution role
- IAM roles and policy for the user roles that access API routes and S3 buckets after authentication
The GitHub repository provides guidance on using registration and login components, accessing cloud REST APIs, storing images, video and other content in the AWS cloud, modifying cloud logic with Lambda and more.
About the Author
David Ramel is an editor and writer at Converge 360.