GitHub LinkedIn Data Fetching

बनाया गया: 20 नवंबर 2024

का उपयोग करके उत्तर दिया गया OpenAI 01 Preview द्वारा OpenAI01

प्रश्न

Owner avatar
developerFolio
Public
saadpasta/developerFolio
Go to file
t
Add file
Folders and files
Name
Latest commit
namanagrwl
namanagrwl
Updated Dockerfile (#672)
fc69340
·
last month
History
.github
fix(ci): update workflow to use node 18.x (#646)
last year
public
chore(): update font awesome cdn from 5.13 to 5.15 (#422)
3 years ago
src
Added target='_blank' and rel='noreferrer' to external link in Footer… (
last month
.all-contributorsrc
docs: add KazAttarwala as a contributor for code (#605)
last year
.gitattributes
Fix font in the logo-name (#401)
3 years ago
.gitignore
Fix fallback for medium blogs (#446)
3 years ago
.pre-commit-config.yaml
[pre-commit.ci] pre-commit autoupdate (#478)
last year
.prettierignore
feat: add prettier and a check for it using gh actions (#259)
3 years ago
.prettierrc
feat: add prettier and a check for it using gh actions (#259)
3 years ago
Dockerfile
Updated Dockerfile (#672)
last month
LICENSE
Switch to GPLv3
4 years ago
README.md
fix: resume path in Readme (#734)
last month
env.example
Added medium blogs fetch feature for blogs section (#445)
3 years ago
fetch.js
Feature/GitHub jobs (#519)
2 years ago
package-lock.json
fix(ci): fix build failing due to old (and deprecated) packages (#630)
last year
package.json
fix(ci): fix build failing due to old (and deprecated) packages (#630)
last year
Repository files navigation
README
GPL-3.0 license
Software Developer Folio ⚡️ GitHub GitHub stars All Contributors
A clean, beautiful and responsive portfolio template for Developers!


Just change src/portfolio.js to get your personal portfolio. Customize portfolio theme by using your own color scheme globally in the src/_globalColor.scss file. Feel free to use it as-is or personalize it as much as you want.

If you'd like to contribute and make this much better for other users, have a look at Issues.

Created something awesome for your fork of the portfolio and want to share it? Feel free to open a pull request.

Table of Contents
Sections
Getting Started
How to Use
Linking portfolio to GitHub
Linking blogs section to Medium
Change and Customize
Deployment
Technologies Used
Illustrations
For the Future
Contributors
Portfolio Sections
✔️ Summary and About me
✔️ Skills
✔️ Education
✔️ Work Experience
✔️ Open Source Projects Connected with GitHub
✔️ Big Projects
✔️ Achievements And Certifications 🏆
✔️ Blogs
✔️ Talks
✔️ Podcast
✔️ Contact me
✔️ Twitter Timeline
✔️ GitHub Profile

To view a live example, click here.

Getting Started
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.

You'll need Git and Node.js (which comes with npm) installed on your computer or use Docker.

[email protected] or higher
[email protected] or higher
[email protected] or higher
Docker Commands
1) BUILD IMAGE : docker build -t developerfolio:latest .
2) RUN IMAGE: docker run -t -p 3000:3000 developerfolio:latest
How To Use
From your command line, clone and run developerFolio:

# Clone this repository
git clone https://github.com/saadpasta/developerFolio.git

# Go into the repository
cd developerFolio

# Setup default environment variables

# For Linux
cp env.example .env
# For Windows
copy env.example .env

# Install dependencies
npm install

# Start a local dev server
npm start
Linking Portfolio to GitHub
Generate a classic GitHub personal access token following these instructions (make sure you don't select any scope just generate a simple token). If you are using GitHub Actions to deploy your portfolio you can skip this section.

Create a file called .env in the root directory of your project (if not done already in section: How To Use)
Note: Configuring environment variables before deploying your portfolio is highly recommended as some components depend on API data.

- DeveloperFolio
- node_modules
- public
- src
- .env <-- create it here
- env.example <-- this is the base file
- .gitignore
- package-lock.json
- package.json
Inside the .env file, add key REACT_APP_GITHUB_TOKEN and assign your GitHub token like this, also add your username as GITHUB_USERNAME
// .env
REACT_APP_GITHUB_TOKEN = "YOUR GITHUB TOKEN HERE"
GITHUB_USERNAME = "YOUR GITHUB USERNAME"
USE_GITHUB_DATA = "true"
Set showGithubProfile to true or false to show Contact Profile using GitHub, defaults to false.

Warning: Treat your tokens like passwords and keep them secret. When working with the API, use tokens as environment variables instead of hardcoding them into your programs.

Note: Open Source Projects section only show pinned items of your GitHub. If you are seeing something as shown below, follow these instructions.

ERROR

If the above solution still doesn't work, visit the wiki page.

Linking blogs section to Medium
Optionally, you can link the blogs section to your medium user account:

Inside the .env file, add key MEDIUM_USERNAME and assign your Medium username
// .env
MEDIUM_USERNAME = "YOUR MEDIUM USERNAME"
For Github Action, change the environment variable MEDIUM_USERNAME in .github/workflows/deploy.yml
Set displayMediumBlogs to true or false in portofolio.js to display fetched Medium blogs, defaults to true.

Change and customize every section according to your need.
Personalize page content in /src/portfolio.js & modify it as per your need. You will also need to modify index.html to change the title and metadata to provide accurate SEO for your personal portfolio.
/* Change this file to get your Personal Porfolio */

const greeting = {
/* Your Summary And Greeting Section */
title: "Hi all I'm Saad",
subTitle: emoji("A passionate Full Stack Software Developer 🚀"),
resumeLink: "https://drive.google.com/file/d/1ofFdKF_mqscH8WvXkSObnVvC9kK7Ldlu/view?usp=sharing"
};

const socialMediaLinks = {
/* Your Social Media Link */
github: "https://github.com/saadpasta",
linkedin: "https://www.linkedin.com/in/saadpasta/",
gmail: "[email protected]",
gitlab: "https://gitlab.com/saadpasta",
facebook: "https://www.facebook.com/saad.pasta7"
};


const skillsSection = { .... }

const techStack = { .... }

const workExperience = { .... }

const openSource = { .... }

const bigProjects = { .... }

const achievementSection = { .... }

const blogSection = { .... }

const contactInfo = { .... }

const twitterDetails = { ... }
Resume upload
To upload your own resume, simply upload a pdf to src/containers/greeting/resume and rename the pdf to resume.pdf.

Using Emojis
For adding emoji 😃 into the texts in Portfolio.js, use the emoji() function and pass the text you need as an argument. This would help in keeping emojis compatible across different browsers and platforms.

Customize Lottie Animations
You can choose a Lottie and download it in json format from sites like this. In src/assets/lottie, replace the Lottie json file you want to alter with the same file name. If you want to change the Lottie options, go to src/components/displayLottie/DisplayLottie.js and change the defaultOptions object, you can refer lottie-react docs for more info on the defaultOptions object.

Adding Twitter Time line to your Page
Insert your Twitter username in portfolio.js to show your recent activity on your page.

const twitterDetails = {
userName : "Your Twitter Username"
};
Note: Don't use @ symbol when adding username.

Deployment
When you are done with the setup, you should host your website online. We highly recommend to read through the Deploying on GitHub Pages docs for React.

Configuring GitHub Actions (Recommended)
First you should enable, GitHub Actions for the repository you use.

The Profile and the Repository information from GitHub is only created at the time of deploy and the site needs to be redeployed if those information needs to be updated. So, a configurable CRON Job is setup which deploys your site every week, so that once you update your profile on GitHub it is shown on your portfolio. You can also trigger it manually using workflow_dispatch event, see this guide on how to do that.

When you are done with the configuration, we highly recommend to read through the GitHub Actions Configuring a workflow docs.
Deploying to GitHub Pages
This section guides you to deploy your portfolio on GitHub pages.

Navigate to package.json and enter your domain name instead of https://developerfolio.js.org/ in homepage variable. For example, if you want your site to be https://<your-username>.github.io/developerFolio, add the same to the homepage section of package.json.

In short you can also add /devloperFolio to package.json as both are exactly same. Upon doing so, you tell create-react-app to add the path assets accordingly.

Optionally, configure the domain. You can configure a custom domain with GitHub Pages by adding a CNAME file to the public/ folder.

Follow through the guide to setup GitHub pages from the official CRA docs here.

Deploying to Netlify
You could also host directly with Netlify by linking your own repository.

Deploy To Netlify

For more information, read hosting on Netlify.

Technologies Used
React
graphql
apollo-boost
react-twitter-embed
react-easy-emoji
react-headroom
color-thief i want to make it dynamic fetch data automatcially form github an linledin using username or url and dio ti automatically and i want every section to change dynamically for every user

विचार

Understanding the context

Interestingly enough, the user's input is a lengthy text from a GitHub repository README.md file, likely for a project named "developerFolio" — a personal portfolio website for developers.

Dynamizing data fetching

I’m thinking about how to dynamically fetch and update data from GitHub and LinkedIn for each user in the developerFolio project. This could enhance personalization and user experience.

Examining data formatting

I’m looking into how GitHub releases data in JSON, XML, or HTML, while LinkedIn uses JSON-LD or XML for structured data.

Fetching GitHub details

Hmm, I’m thinking about harnessing the GitHub REST API to dynamically gather and update user data, like repositories and contributions, into the developerFolio project, ensuring seamless, real-time data integration.

Crafting API connections

I’m sketching out endpoints to tap into user profiles, repositories, and contributions via GET requests. Adding authentication amps up request limits to 5,000 per hour.

Navigating LinkedIn access

Accessing LinkedIn data is more challenging due to restrictions and requires approval from LinkedIn's Marketing Developer Platform, or manual user input.

Enhancing data interaction

I’m crafting a form for GitHub and LinkedIn data. This involves syncing inputs, fetching GitHub data via the API, handling LinkedIn data limitations, updating components dynamically, and effectively managing state for smooth data flow.

Tackling asynchronous data

I'm adding loading states and error handling to manage data fetching. Avoid exposing API keys in frontend code, and remember to consider CORS issues.

Securing API keys

Don't expose API keys in the frontend. Use environment variables or a backend to handle API requests securely. Be aware of CORS policies.

Ensuring functionality

I’m thinking through testing with various GitHub usernames to confirm the app handles diverse data inputs, including edge cases like users without repositories or contributions.

Fetching GitHub user data

I’m coding a React component to fetch GitHub user data using the GitHub API. This component will dynamically show user details like avatar, name, and bio.

Managing data access

I'm thinking about how to dynamically keep a portfolio updated with data from platforms like GitHub, while suggesting manual data entry from forms or exploring other accessible platforms due to LinkedIn's restrictions.

उत्तर

Certainly! You want to enhance the developerFolio project so that it dynamically fetches data from GitHub and LinkedIn using a username or URL, allowing each section to update automatically for every user. This can make the portfolio template more versatile and user-friendly.

Here's how you can achieve this:


1. Fetching Data from GitHub

Use GitHub's REST API

GitHub provides a robust API that allows you to fetch user information, repositories, contributions, and more.

  • Set Up API Access:

    • Unauthenticated Requests:
      • Limited to 60 requests per hour per IP address.
    • Authenticated Requests:
      • Increase the rate limit to 5,000 requests per hour.
      • Generate a Personal Access Token (no scopes needed for public data).
  • Fetch User Data:

    • Profile Information:
      • Endpoint: https://api.github.com/users/{username}
    • Repositories:
      • Endpoint: https://api.github.com/users/{username}/repos
  • Implementation in React:

    // src/components/GithubProfile.js import React, { useEffect, useState } from 'react'; import axios from 'axios'; const GithubProfile = ({ username }) => { const [profile, setProfile] = useState(null); useEffect(() => { const fetchProfile = async () => { try { const response = await axios.get(`https://api.github.com/users/${username}`); setProfile(response.data); } catch (error) { console.error('Error fetching GitHub data:', error); } }; fetchProfile(); }, [username]); if (!profile) return <div>Loading...</div>; return ( <div> <h1>{profile.name}</h1> <p>{profile.bio}</p> <img src={profile.avatar_url} alt={`${profile.login}'s avatar`} /> {/* Add more profile details as needed */} </div> ); }; export default GithubProfile;
  • Display Repositories:

    // src/components/GithubRepos.js import React, { useEffect, useState } from 'react'; import axios from 'axios'; const GithubRepos = ({ username }) => { const [repos, setRepos] = useState([]); useEffect(() => { const fetchRepos = async () => { try { const response = await axios.get(`https://api.github.com/users/${username}/repos`); setRepos(response.data); } catch (error) { console.error('Error fetching repositories:', error); } }; fetchRepos(); }, [username]); return ( <div> <h2>Repositories</h2> <ul> {repos.map(repo => ( <li key={repo.id}> <a href={repo.html_url} target="_blank" rel="noopener noreferrer"> {repo.name} </a> </li> ))} </ul> </div> ); }; export default GithubRepos;
  • Note: Remember to handle pagination if the user has many repositories.


2. Fetching Data from LinkedIn

Understand LinkedIn API Limitations

LinkedIn's API is restricted and primarily available to partners or through their Marketing Developer Platform.

  • Options:

    • Manual Data Input:
      • Ask users to provide their LinkedIn data manually via a form.
    • Use LinkedIn's Share URLs:
      • You can link to the user's LinkedIn profile or use share badges.
    • Third-Party Services:
      • Use services like Zapier or Phantombuster with caution, ensuring compliance with LinkedIn's terms of service.
  • Implementation Suggestion:

    Since automated fetching is not feasible, consider creating a form where users can input their professional information, which can then be displayed dynamically.


3. Creating a Dynamic Input System

Build a User Input Form

  • Component for User Input:

    // src/components/UserInputForm.js import React, { useState } from 'react'; const UserInputForm = ({ setUsername, setLinkedInUrl }) => { const [githubUsername, setGithubUsername] = useState(''); const [linkedInUrl, setLinkedInUrlInput] = useState(''); const handleSubmit = (e) => { e.preventDefault(); setUsername(githubUsername); setLinkedInUrl(linkedInUrl); }; return ( <form onSubmit={handleSubmit}> <label> GitHub Username: <input type="text" value={githubUsername} onChange={(e) => setGithubUsername(e.target.value)} /> </label> <label> LinkedIn URL: <input type="text" value={linkedInUrl} onChange={(e) => setLinkedInUrlInput(e.target.value)} /> </label> <button type="submit">Generate Portfolio</button> </form> ); }; export default UserInputForm;
  • Update the Main App Component:

    // src/App.js import React, { useState } from 'react'; import UserInputForm from './components/UserInputForm'; import GithubProfile from './components/GithubProfile'; import GithubRepos from './components/GithubRepos'; function App() { const [username, setUsername] = useState(null); const [linkedInUrl, setLinkedInUrl] = useState(null); return ( <div className="App"> {!username ? ( <UserInputForm setUsername={setUsername} setLinkedInUrl={setLinkedInUrl} /> ) : ( <> <GithubProfile username={username} /> <GithubRepos username={username} /> {/* Include LinkedIn components or links */} <a href={linkedInUrl} target="_blank" rel="noopener noreferrer"> View LinkedIn Profile </a> </> )} </div> ); } export default App;

4. Dynamic Section Updates

Modify Existing Components

  • Accept Props or Context:

    • Ensure each section/component can accept data as props or consume it from a context provider.
  • Example:

    // src/components/SkillsSection.js import React from 'react'; const SkillsSection = ({ skills }) => { return ( <div> <h2>Skills</h2> <ul> {skills.map(skill => ( <li key={skill}>{skill}</li> ))} </ul> </div> ); }; export default SkillsSection;
  • Populate Skills from GitHub Data:

    • You might infer skills from the user's repositories' languages.

5. Handling Asynchronous Data

Implement Loading and Error States

  • Loading Indicators:

    if (isLoading) { return <div>Loading...</div>; }
  • Error Handling:

    if (error) { return <div>Error fetching data: {error.message}</div>; }

6. State Management

Consider Using Context or State Management Libraries

  • React Context API:

    • Use context to pass down user data without prop drilling.
  • Redux or MobX:

    • For larger applications, a state management library can help manage complex state.

7. Security Considerations

Protect API Keys and Tokens

  • Environment Variables:

    • Store sensitive information in environment variables (.env file) and ensure it's listed in .gitignore.
  • CORS and Backend Proxy:

    • If you encounter CORS issues, set up a simple backend to act as a proxy for API requests.

8. Deployment

Prepare for Production

  • Build Optimization:

    • Run npm run build to create an optimized production build.
  • Hosting:

    • Deploy on platforms like Netlify, Vercel, or GitHub Pages.
  • Environment Variables in Deployment:

    • Ensure your hosting platform is configured to handle environment variables securely.

9. Testing

Test with Multiple User Inputs

  • Various GitHub Users:

    • Test with usernames that have different amounts of data.
  • Edge Cases:

    • Users with no repositories, no profile picture, etc.

10. Future Enhancements

Additional Integrations

  • Other Platforms:
    • Integrate with APIs from platforms like Twitter, Medium, or Dev.to for blog posts.

Customization Options

  • Themes:

    • Allow users to select or customize themes.
  • Layout Adjustments:

    • Enable rearranging or toggling sections.

Important Notes

  • Compliance with Terms of Service:

    • Always ensure you're complying with the API providers' terms of service.
    • Avoid scraping data or using unofficial methods to obtain user information.
  • User Consent:

    • If you extend this tool for public use, ensure users consent to their data being fetched and displayed.

Conclusion

By implementing the above steps, you'll transform the developerFolio template into a dynamic, user-driven portfolio generator. Users can input their GitHub username and LinkedIn URL to automatically populate their portfolio with up-to-date information.


Let me know if you need further clarification or assistance with any of these steps!

इस प्रश्नोत्तर को साझा करें