Examples

Integrate with any stack

Ready-to-use examples to copy and paste. Each example shows from basic calls to advanced filters and error handling.

Examples

Integrate with any stack

Copy and paste. Works with any language or framework.

JavaScript
// Fetch repositories from a user
const response = await fetch(
  "https://api-pearl-nine-29.vercel.app/api/github?user=USERNAME"
);
const data = await response.json();

// Access data
console.log(data.stats.total_repos);  // Total repos
console.log(data.stats.total_stars);  // Total stars
console.log(data.projects);           // Repo list

// With filters
const filtered = await fetch(
  "https://api-pearl-nine-29.vercel.app/api/github?user=USERNAME&language=TypeScript&sort=stars"
).then(res => res.json());

Tip

Replace USERNAME with the desired GitHub username. The API is public and accepts any user with public repositories.

Tutorial: Projects section in your portfolio

1

Understand the API URL

The base API URL is fixed. You just need to replace {username} with the GitHub username whose repos you want to display.

2

Make the call in your component

Use fetch inside a useEffect (React) or directly in a server component (Next.js). The API returns JSON, so just call .json().

3

Render the data

Each project comes with name, description, language, stars, URL and much more. Use the fields that make sense for your design.

4

Add statistics (optional)

Use the stats object to display a summary at the top of the projects section.

Why use GitReposAPI in your portfolio?

Always updated

Your projects appear automatically as you create new repos on GitHub. No need to manually edit your portfolio.

Rich data

Language, stars, description, demo URL, topics, dates. Everything you need to build a complete card.

Zero configuration

No backend, database, authentication or deploy needed. One GET call and you have everything.

Performance

Response in under 200ms with 10-minute cache. Your portfolio loads fast without hurting the experience.

Smart filters

Show only repos of a language, sort by stars, or exclude forks. Full control over what appears.

Secure and reliable

Hosted on Vercel with input validation, rate limit handling and configured CORS. Production ready.