Templates

Github Trending Topics

Github Trending Topics

This template is a simple example of how to build a data pipeline for Github trending topics.

Getting Started

Clone the repository:

To get started with this template, you can run the following command:

terminal
npx create-moose-app moose-github-dev-trends github-dev-trends

Install dependencies:

terminal
cd moose-github-dev-trends/moose-backend && npm install

Project Structure

moose-github-dev-trends/
├── live-dev-trends-dashboard/ # Frontend dashboard application
├── moose-backend/ # Backend services
└── README.md # Project documentation

Run the application

terminal
npm run dev

This workflow will run a script every 60 seconds to poll GitHub for trending topics:

terminal
moose workflow run getGithubEvents

Scheduled Workflows

The workflow is scheduled to run every 60 seconds. Learn how to schedule workflows.

(Bonus) Create a .env file and add your GitHub API Key

You will be able to poll the GitHub API without any authentication credentials, but you will be limited to 60 requests per hour.

To increase the limit, you can create a .env file and add your GitHub personal access token:

terminal
touch .env
.env
GITHUB_TOKEN=<your-github-api-key>

DO NOT COMMIT THIS FILE TO VERSION CONTROL

Add .env to your .gitignore file:

.gitignore
.env

Creating a GitHub Personal Access Token

Learn how to create a GitHub personal access token.

Explore the Data

The template includes a dashboard application that you can use to explore the data. It is located in the live-dev-trends-dashboard directory.

Terminal
cd moose-github-dev-trends/live-dev-trends-dashboard && npm install && npm run dev

View the Dashboard

Go to http://localhost:3000 to view the dashboard.

Explore the API Powering the Dashboard

The dashboard is powered by a Consumption API in the moose-backend project. The code is located in the app/apis/topicTimeseries.ts file.

Feel free to check out how the code works, or even modify it to suit your own interests!