BiteTut is a serverless e-commerce storefront that provides subscription-based online learning content managed by headless CMS.
- Create, manage and publish content with Contentful
- Manage recurring payments using Stripe
- Secure user authentication and access control using AWS Cognito
- Highly customizable components with full theming support using styled-components
- Deploy and manage AWS infrastructure to use AWS Lambda functions with the Serverless Framework
This project consists of a ReactJS front-end and a serverless back-end using AWS Lambda. The following AWS services are also used in this project:
- S3: a public S3 bucket to host the React web app and a private S3 bucket to store private content
- Simple Email Service (SES): notify customers with the pre-sign URL of the private content
- Cognito: user sign-in and access control
- Simple Notification Service (SNS): save user information to DynamoDB when a user is created in the Cognito user pool
- DynamoDB: store user account information (e.g. user email and their Stripe customer ID)
React app screenshots
- # for a Contentful account
- Create an empty Space to hold your content
- Set up content model
- Configure the Contentful Javascript SDK using your set of the access token and space ID
- # for a Stripe account
- Obtain the Stripe API keys
- # for an AWS account
- Create an IAM User and Access Key
- Set up credential with AWS CLI
Follow the following steps to run the React application and the serverless backend locally.
git clone https://github.com/rangle/serverless-app-poc.git
- Update placeholder credentials listed in the
.env.example
file, and rename this file to.env
- Install dependencies for the project
cd frontend
# install dependencies for the React application
yarn install
# run the application locally
yarn start
cd backend
# install dependencies for the serverless application
yarn install
# run lambda functions offline
yarn dev
.
├── frontend # ReactJS application
│ ├── src
│ │ ├── components # styled-components
│ │ ├── content # content service, contentful config
│ │ ├── payment # payment service with Stripe
│ │ ├── auth # auth service with Cognito, auth context
│ │ ├── theme # theme config for styled-components
│ │ └── ...
│ └── ...
├── backend # Serverless backend
│ ├── src # lambda functions
│ └── serverless.yml # defines AWS infrastructure resources
└── README.md