Boilerplate code for a bare bones React frontend that can be used to build UI demos and examples on the Cloud Elements APIs. Keep in mind that Cloud Elements is a server-side API library, production applications should not store keys or make API calls directly from client-side code. This project is meerly a source of sample code intended as a tool for gaining familiarity with the Cloud Elements APIs in a user-facing example.
The goal for this code base is to be as beginner friendly as possible. The app has a crude routing implementation and does not utilize any 3rd party state management tools. In addition, it does not include a connected backend, it utilizes browser based local storage for occasions where a backend database would be useful. If you're interested in a version of this app that contains additional functionality, please file an issue.
If you don't have node
and npm
installed, do that first.
PROTIP:
node
version must be >=7.5.0
andnpm
version must be >=4.1.2
Navigate into the project directory and install package dependencies.
# Make sure you are in the correct directory
$ cd cloud-elements-boilerplate
# Install all necessary npm packages:
$ npm install
# or
$ yarn install
Create an environment file to store keys and tokens
$ touch .env
# or
touch .env.local
Add your Cloud Elements keys to the .env
file:
## Cloud Elements keys
REACT_APP_CE_USER={your-cloud-elements-user-token}
REACT_APP_CE_ORG={your-cloud-elements-org-token}
REACT_APP_CE_ENV=[optional for using staging or snapshot, app defaults to production]
Add your vendor OAuth app keys to the .env
file. Only one is needed for the app to function, but total number is unlimited. These keys are utilized in the LoginCardList component.
## Vendor App keys
REACT_APP_HUBSPOT_KEY={your-hubspot-oauth-app-key}
REACT_APP_HUBSPOT_SECRET={your-hubspot-oauth-app-secret}
Add the https url where your app is available so that vendor OAuth flows know where to return to after a user signs in.
## Misc
REACT_APP_URL=https://c720e32b.ngrok.io
# Fire that bad boy up:
$ yarn start
# or
$ npm start
This project was bootstrapped with Create React App.
In the project directory, you can run:
Runs the app in the development mode.
Open http://localhost:3000 to view it in the browser.
The page will reload if you make edits.
You will also see any lint errors in the console.
Launches the test runner in the interactive watch mode.
See the section about running tests for more information.
Builds the app for production to the build
folder.
It correctly bundles React in production mode and optimizes the build for the best performance.
The build is minified and the filenames include the hashes.
Your app is ready to be deployed!