The project has two different application in this mono-repo project, and using lerna
to maintain the dependencies and flow.
Lerna helps you run npm
scripts for both projects. Bootstrapping is the first step to install the project dependencies. It will basically run the npm install
for both projects.
npm install
npm run bootstrap
If you want to run the both projects together using lerna,
npm run start:all
This will kick npm start
on both projects. But you need to satisfy the environment variable for the lambda project before running the application. See the next sub-section for further details.
Graphql lambda function is designed to make several requests to different services and aggregate the responses into one single HTTP response. The project is using Apollo Server to serve the graphql POST requests.
In order to succesfully run the full fledged graphql aggregator you need to create a file named .env
under the ./packages/stats-lambda/
folder. Then put the required environment variables into it. You can checkout the .env.sample as an example.
SECRET=SECRET
YOUTUBE=SECRET
YOUTUBE_KEY=SECRET
TWITTER_CONSUMER_API_KEY=SECRET
TWITTER_CONSUMER_API_SECRET_KEY=SECRET
TWITTER_ACCESS_TOKEN=SECRET
TWITTER_ACCESS_SECRET=SECRET
AMAZON_AWS_ACCESS_KEY=SECRET
AMAZON_AWS_ACCESS_SECRET_KEY=SECRET
ENGINE_API_KEY=SECRET
After satifying the environment variables you can simply run the following command in the root folder to start the application.
npm run start
React application is the single page application that displays the results aggregated by the Graphql Server
.
In order to run the application using lerna run the following command.
npm run start:react
React application is using the react-scripts. You can do whatever react-scripts allows you to do.
Why not?
Read the Running the graphql application
section before continue and make sure you have created the .env
file.
To run the both containers run the docker-compose up
command. This will brought up two docker containers for each application.