Skip to main content

Command Palette

Search for a command to run...

GitHub Profile Fetcher (with React JS)

Updated
4 min readView as Markdown
GitHub Profile Fetcher (with React JS)

This article describes my process for creating a web app that dynamically fetches a GitHub profile and the profile details.

A while ago, I had tasked with building a web app that required me to display my own GitHub profile details only by using an API. It was only my first time using the GitHub REST API but it was a nice challenge.

The Process

For this challenge, I drew inspiration from the previous project I built and thought, “why not let anybody get their GitHub details with my web app?" and so I began.

This was an exciting project that offered me as a developer a valuable opportunity to learn about fetching and displaying GitHub profile information using the GitHub API. In this comprehensive article, we will delve into the tools used, and the development process followed, and provide detailed insights into the implementation of this repository. By understanding the technologies, steps, and code snippets involved, developers can gain a deeper understanding and apply these concepts to their own projects.

The development process for the GitHub Profile Fetch repository involves the following key steps:

  1. Setting up the Project:

  2. Designing the User Interface:

    • Create HTML structure: Developers design the necessary HTML elements to display the GitHub profile information and other relevant details. Structuring the UI elements with semantic HTML ensures accessibility and proper information hierarchy.

    • Apply CSS styles: CSS is employed to enhance the visual appearance of the user interface. By applying CSS styles, developers can customize the presentation of elements, including colors, typography, layout, and responsiveness.

  3. Fetching GitHub Profile Information:

    • Implement API calls: Developers leverage JavaScript to make API requests to the GitHub API and fetch the desired user information. They utilize the appropriate API endpoints and authentication methods to retrieve data securely.

    • Parse and handle the data: After receiving the API response, developers parse and process the retrieved data using JavaScript. They extract the relevant information required to display in the user interface.

  4. Displaying the Fetched Data:

    • Update the DOM: With the retrieved data, developers use JavaScript to dynamically update the HTML elements in the user interface. By manipulating the DOM, the profile information is seamlessly integrated and displayed in real-time to the user.
  5. Error Handling and Feedback:

    • Implement error handling: To provide a robust user experience, developers anticipate and handle potential errors that may occur during API requests. They implement appropriate error handling mechanisms to gracefully display error messages or fallback content.

    • Provide user feedback: Enhancing the user experience, developers incorporate loading spinners, progress indicators, or other visual cues to indicate when data is being fetched or processed. This keeps users informed and engaged while the application retrieves and renders the GitHub profile information.

  6. Testing and Optimization:

    • Conduct thorough testing: Developers conduct comprehensive testing to ensure the functionality of the application across different scenarios. They verify that the fetched data is accurate and displayed correctly in the user interface.

    • Optimize performance: Optimizations are identified and implemented to enhance the performance of the application. This may involve minimizing API requests, improving data caching, optimizing code logic, and optimizing the rendering of UI components. Optimizations contribute to a faster and smoother user experience.

I used Vite to create my React Starter project via the npm (node package manager)

For the routing, I utilized the react-router version 6 to define my routes for the Home and Repos pages.

To add some visual candy, I used the react-icons icon library.

I also utilized the React-specific app-wide state management tool to manage states across components and pages for easier accessibility and functionality

Conclusion

The GitHub Profile Fetch repository offers a valuable opportunity to explore the tools, technologies, and development process involved in fetching and displaying GitHub profile information.

You can check out my code here!

Use the dynamic profile fetcher here https://dynamic-repo-fetch.web.app/