This application is written in React Native to help run on both Android and iOS. It uses Expo to build, publish and maintain the application's javascript bundles.
We have 2 channels - production and beta. Production is of course the channel that is used for our customers and beta is used for testing purposes. For any code changes related to beta, please use the beta branch.
- AWS Cognito - for user management
- AWS Lambda - for all backend APIs (all node js functions)
- AWS API Gateway - for managing endpoints to AWS Lambda. These are authenticated using cognito user token
- AWS RDS - our postgres database resides here
- AWS S3 - for storing food images
- AWS Amplify - used for connecting to cognito from react native
- Serverless - used for managing lambda functions
- React Native - for android and ios development
- Expo - for managing javascript bundles
-
Git pull the code base and open it up in VS Code or any other editor of choice
-
Install the AWS CLI and setup your credentials (Talk to @ssrva for credentials)
-
Install the amplify CLI
npm install -g @aws-amplify/cli
amplify configure
amplify env pull
and pull the prod env
-
Download nad install serverless CLI
- All lambda functions reside at
./aws/lambda/aws-postgres-server
serverless-offline
will start the local backend serverserverless deploy --stage beta
will push lambda functions to betaserverless deploy --stage production
will push lambda functions to prod
- All lambda functions reside at
-
Download and install Expo CLI for local testing
expo start
will start the local metro server. Scan the QR code from the popup to run the app on your phoneexpo publish --release-channel beta
for publishing to betaexpo publish --release-channel production
for publishing to prod. (NOTE - This will push directly to production customer's phones. Be careful while running this).expo build:android --release-channel production
orexpo build:ios --release-channel production
to build bundles for android or ios. This is needed to publish updates to the respective stores.expo build:android -t apk --release-channel production
to build an APK file.
-
To build local debug apk follow the steps below
- Run this command to generate the initial JS bundle to use
npx react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res
- Make sure you create assets folder in
android/app/src/main/
before running above command - Delete
android/app/src/main/res/drawable-*
andraw
folder inside it. - cd into android folder and run
./gradlew assembleDebug
to generate the APK. - Generated apk can be found in
android/app/build/outputs/apk
- Run this command to generate the initial JS bundle to use
-
To build a signed bundle
- Run
expo fetch:android:keystore
to get the key file from expo. - Copy the keystore file to 'android/app'.
- Update the keystore credentials into build.gradle file under signingConfigs.release section.
- Run
./gradlew bundleRelease
from inside android folder to generate aab file to upload to playstore. - If you're facing
Duplicate Resource
issue while building, deletedrawable-*
andraw
folders fromandroid/app/src/main/res
- Run
./gradlew assembleRelease
to generate a signed apk.
- Run
iOS development guide
- Instal cocoapods on your mac -
brew install cocoapods
- Run
sudo xcode-select --switch /Applications/Xcode.app
- cd into
ios
folder and runpod install
to install the pods
iOS Testing app through test flight TestFlight on iOS does not allow to have a separate build for testing. The idea is to have the same build as production to be used by testers too. In our use case we want to use a differente expo release channel for test flight builds. Here is the workaround
- Open Xcode, go to YOYOLunchbox > Supporting > Expo.
- Update EXUpdatesReleaseChannel variable to
beta
- Go to Product > Archive
- Upload the archive to app store connect.
- Once the upload is done, the build should be visible on TestFlight app.
- Once all the testing is completed build another archive by switching back EXUpdatesReleaseChannel to production
- Upload to app store connect and make a release.