GitHub Profile Details

Fetch and print public details for a GitHub user.

Start building, submit solution and get feedback from the community.
2Submit Solution
5 upvotes10 upvotes

GitHub Profile Details

You are required to build a CLI tool using Node.js that prints public profile details for a GitHub user.

The tool should accept a GitHub username from the terminal. If the user does not pass a username, it should print a friendly error.

Here are some example commands you can run to test your CLI:

bash
node github-profile.js octocatnode github-profile.js missing-user-name-examplenode github-profile.js

On successful execution, the output should look like this:

txt
Name: The OctocatUsername: octocatProfile: https://github.com/octocatPublic repos: 8Followers: 20000

The exact follower count can be different when you run the command.

If the GitHub user does not exist, print a friendly error:

txt
error: GitHub user not found: missing-user-name-example

If the user does not pass a username, print this error:

txt
error: please provide a GitHub username

Errors should go to stderr, and the command should set a non-zero exit code.

The goal of this project is to practice reading command arguments, calling an API from Node.js, handling failed responses, and printing useful data in the terminal.

You will need these Node.js APIs:

  • process.argv to read the username from the terminal.

  • fetch to call the GitHub API.

  • encodeURIComponent() to safely place the username in the URL.

Join the Community

roadmap.sh is the most starred project on GitHub and is visited by hundreds of thousands of developers every month.

Rank  out of 28M!

361K

GitHub Stars

Star us on GitHub
Help us reach #1

+90k every month

+2.1M

Registered Users

Register yourself
Commit to your growth

+2k every month

49K

Discord Members

Join on Discord
Join the community

Roadmaps Best Practices Guides Videos FAQs YouTube

roadmap.sh by @kamrify

Community created roadmaps, best practices, projects, articles, resources and journeys to help you choose your path and grow in your career.

ThewNewStack

The top DevOps resource for Kubernetes, cloud-native computing, and large-scale development and deployment.