RealDevSquad / RealDevSquad/website-backend

[RFC]: Store Org's all Pull Requests in Real Dev Squad Backend Database and Webhook Integration

Open
#1,133 2 comments 0 reactions 1 assignee View on GitHub

@sahsisunny is already working on this.

Since Jun 4, 2023.

Dominant language
JavaScript
Stars
74
Forks
276
Avg merge
1d 26m
Merged PRs (30d)
14

Description

[RFC]: Store Org's all Pull Requests in Real Dev Squad Backend Database and Webhook Integration

Feature Name: Store Org's all Pull Requests in Real Dev Squad Backend Database and Webhook Integration

Summary

This RFC proposes a solution to store all pull requests from the Real Dev Squad organization in the Real Dev Squad backend database. It also suggests integrating a webhook to receive real-time updates from GitHub and keep the backend database synchronized.

Motivation

The purpose of this RFC is to outline a solution for storing Real Dev Squad's GitHub pull requests in the Real Dev Squad backend database. By integrating a webhook, the backend database can be updated in real-time, ensuring data consistency and providing a streamlined workflow.

Detailed design

1. Introduction

This RFC proposes storing the GitHub pull requests of the Real Dev Squad organization in the Real Dev Squad backend database. It also suggests using a webhook to retrieve the latest data from GitHub and keep the backend database updated in real-time.

2. Background

Real Dev Squad uses GitHub for source code management and collaboration. The Real Dev Squad backend database serves as a central repository for various organization data. To streamline workflows and maintain data consistency, it is essential to synchronize pull request information from GitHub into the backend database.

3. Objectives

The objectives of this RFC are as follows:

  • Store pull request data in the backend database: Extract relevant information from GitHub pull requests and store it in the backend database.
  • Real-time updates: Implement a webhook to receive notifications from GitHub for pull request creation, updates, and closures, enabling real-time updates in the backend database.
  • Data integrity: Ensure stored pull request data is accurate, up-to-date, and consistent with corresponding pull requests in GitHub.
4. Proposed Solution
4.1. Database Schema

Design an appropriate database schema to store pull request data in the backend database. The schema should include fields such as pull request ID, title, description, author, creation timestamp, last update timestamp, status (open/closed), and other relevant information.

4.2. API Endpoint

Create an API endpoint in the Real Dev Squad backend to handle incoming requests for storing pull request data. The endpoint should process received data and persist it in the backend database.

4.3. Webhook Integration

Integrate a webhook mechanism with GitHub to receive event notifications related to pull requests. Configure the webhook to send notifications to the designated endpoint in the backend whenever a pull request is created, updated, or closed.

4.4. Event Processing

Upon receiving a webhook notification, the backend should authenticate the request, extract relevant data associated with the pull request, and process it. The processed data should be stored or used to update the corresponding record in the backend database.

4.5. Error Handling

Implement appropriate error handling mechanisms to address cases where webhook notifications fail to be processed or stored in the backend database. This may include logging, error notifications, and retry mechanisms to maintain data consistency.

5. Security Considerations

Ensure the API endpoint and webhook integration are secured using appropriate authentication mechanisms (e.g., OAuth or API keys) to prevent unauthorized access and data tampering.

6. Future Enhancements

In the future, consider additional features to enhance the pull request integration, such as implementing a two-way synchronization to update pull request status in GitHub when modified in the backend database.

Drawbacks

Drawbacks of the proposed design are:

  • Additional configuration and maintenance requirements for the webhook integration.
  • The need for additional security measures to protect the API endpoint from unauthorized access and data tampering.
  • Potential requirement for additional resources to implement and maintain the solution.

Unresolved questions

  • Name of the API endpoint to be created in the backend. For example - /pull-requests.
  • GitHub API endpoint to be used for retrieving pull request data.
  • Database schema for storing pull request data in the backend database.
  • How will the API endpoint process incoming requests and store pull request data in the backend database?
  • How will the API endpoint handle errors and ensure data consistency?
  • How will the webhook be configured to receive notifications from GitHub?
  • How will the backend authenticate webhook requests?
  • How will the backend process webhook notifications and store pull request data in the backend database?
  • What security measures will be implemented to protect the API endpoint from unauthorized access and data tampering?
  • Does API have GET, POST, PUT, DELETE methods?
Conclusion

This RFC proposes storing Real Dev Squad's GitHub pull requests in the Real Dev Squad backend database through webhook integration. The solution allows for real-time updates and ensures data consistency. Additional configuration and maintenance efforts may be required for the webhook integration and API endpoint. Security measures must be implemented to protect against unauthorized access and data tampering. Alternatives considered include periodic data storage using scheduled jobs, which do not provide real-time updates.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.