Github commit searcher

Dmytro Werner - Aug 27 '22 - - Dev Community

Overview of My Submission

What?
This is basic project to find messages in your commit history.

Why?
I was thinking to create app to get information from my commits if i want to find some important message that was wrote before.

How?
To get information was used Github-API and to run Redis locally was used Docker.

Improvement ideas

  • use GitHub Actions to update information automatically
  • save more dat and filter this data in frontend
  • use advance caching from Redis to increase performance

Submission Category:

MERN/RERN(Redis,Express,React,Node) Mavericks

Language Used

  • JavaScript

Tech-Stack

  • Redis to store data (database)
  • Redis to search data (search engine)
  • Node with express (backend)
  • React (frontend)

Link to Code

Commit-Searcher

Small project to search commits from your repository.

Example

alt text

How it works

How the data is stored:

After server was loaded data will be stored to Redis database from api endpoint.

There are several steps to:

  • create Schema like this:
const commitSchema = new Schema(Commit, {

    message: { type: 'text' },

    author: { type: 'string' },

    url: { type: 'string' }

})
  • get data from your repository:
const response = octokit.request('GET https://api.github.com/repos/{owner}/{repo}/commits', {

    owner: process.env.GITHUB_OWNER,

    repo: process.env.GITHUB_REPO

});
  • save data to Redis
response.then(function(result) {

    result.data.map((commit) => {

        saveDataToRedis(

            commit.commit.message,

            commit.commit.author.name,

            commit.html_url,

        )

    })

})
  • create index in Redis:
await  commitRepository.createIndex()

How the data is accessed:

Data will be loaded from server via endpoints to frontend. There you can see all commits and search for data.

  1. Get all data (used search() function from Redis repository)
app.get('/commits', async (req, res) => {

    const commits = await commitRepository.search().return.all();

    res.json(commits)

})
  1. Search messages…

Licence: MIT

Additional Resources / Info

Github-Api
Docker-Image

Collaborators

Solo project

. . . . .