What this app about ?
This is a mock grocery purchase app built on the serverless technology.
- Serverless Lambda Functions were written to serve as a backend REST APIs.
- Front End is done with React which uses those APIs
To explore the limit of serverless framework
App will have users who can register / login
- List of grocery items based on various categories (Eatable, drinkable, cookable, hyigene)
- Add items to cart if that stock is present for a grocery item.
- Checking out from a cart to place order
- Payment for an order / Cancelling the order
To be built
- A global search bar for item search
- Chat functionality between users and customer support (Admin of the app)
- Install AWS CLI
- Add user based on AWS credentials which will be shared directly.
- Auth will be currently based on AWS Cognito. Login / Registration will be handled by the front end auth module directly with the cognito. Lambda functions won't be responsible for auth. It requires an userId (AccessKeyId) based on which we will maintain the DB.
- All other APIs will be working locally.
- Front End would be developed locally and finally deployed on S3.
Accounts Required to deploy on cloud
- Cognito user pool to be created which will manage users in the app. You need to specify it on the front end as mentioned later in the readme. Also For backend refer
To Setup Backend point 10
- Deployment will use S3, API gateway and lambda functions along with DynamoDB. Ensure that you have access in your AWS on which it will be deployed
To setup Backend:
- Choose a region as per AWS (Our App is ap-south-1).
- Check out
utils/config.jsand change the region as per that. Choose db url locally or accordingly on Cloud. For more details look at https://docs.aws.amazon.com/general/latest/gr/rande.html
- Install AWS DynamoDB for this region locally and run the server which will default to port 8000.
npm run initialize-dbto create all db tables with populated value (Local / cloud depending upon the config url)
- At any moment you can use
npm run reinitialize-dbto flush all the data present in the tables.
- For the current version auth should be used with cognito.
npm install -g serverlessto install serverless globally
npm installin the backend repository.
npm run startwill start the serverless backend offline.
- Certain routes are protected by cognito pool. Change the
serverles.yamlas per your cognito pool to have authenticated routes.
To setup Frontend:
- Create .env file under
packages/CB-serverless-frontendfolder with below variables: REACT_APP_REGION=XXXXXX REACT_APP_URL=http://localhost:3000 REACT_APP_REGION=XXXXXX REACT_APP_USER_POOL_ID=XXXXXX REACT_APP_APP_CLIENT_ID=XXXXXX REACT_APP_IDENTITY_POOL_ID=XXXXXX
you can use 4242 4242 4242 4242 for card number or refer stripe for more.
npm installto install
npm run startto start