Skip to main content
This page documents all TypeScript interfaces and data models used throughout the GitHub Wrapped API. All interfaces are defined in types/index.ts.

Repository Models

RepositoryInfo

Basic repository metadata.
owner
string
Repository owner username or organization name
repo
string
Repository name
name
string
Full repository name in owner/repo format
description
string | null
Repository description (null if not set)
stars
number
Total star count
forks
number
Total fork count
language
string | null
Primary programming language (null if not detected)
export interface RepositoryInfo {
  owner: string;
  repo: string;
  name: string;
  description: string | null;
  stars: number;
  forks: number;
  language: string | null;
}

User Models

UserProfile

GitHub user profile information.
username
string
GitHub username
avatar_url
string
URL to user’s avatar image
name
string | null
User’s display name (null if not set)
bio
string | null
User’s bio (null if not set)
public_repos
number
Number of public repositories
followers
number
Number of followers
total_stars
number
Total stars across all repositories owned by the user
export interface UserProfile {
  username: string;
  avatar_url: string;
  name: string | null;
  bio: string | null;
  public_repos: number;
  followers: number;
  total_stars: number;
}

Contributor Models

Contributor

Contributor statistics for a repository.
login
string
GitHub username
avatar_url
string
URL to contributor’s avatar image
contributions
number
Number of contributions (commits)
linesAdded
number
Total lines of code added
linesRemoved
number
Total lines of code removed
export interface Contributor {
  login: string;
  avatar_url: string;
  contributions: number;
  linesAdded?: number;
  linesRemoved?: number;
}

Activity Models

CommitStats

Commit activity statistics and patterns.
total
number
Total number of commits
byMonth
Record<string, number>
Commits grouped by month nameExample: { "Jan": 45, "Feb": 67, "Mar": 89 }
byDayOfWeek
Record<string, number>
Commits grouped by day of weekExample: { "Sunday": 12, "Monday": 45, "Tuesday": 67 }
byHour
Record<string, number>
Commits grouped by hour of day (0-23)Example: { "0": 5, "9": 45, "14": 67, "23": 12 }
busiestMonth
object
Month with highest activity
busiestWeek
object
Week with highest activity
averagePerDay
number
Average commits per day
export interface CommitStats {
  total: number;
  byMonth: Record<string, number>;
  byDayOfWeek: Record<string, number>;
  byHour: Record<string, number>;
  busiestMonth: { month: string; count: number };
  busiestWeek: { week: string; count: number };
  averagePerDay: number;
}

LanguageStats

Programming language usage statistics.
language
string
Programming language name (e.g., “TypeScript”, “JavaScript”)
bytes
number
Total bytes of code in this language
percentage
number
Percentage of total codebase (0-100)
export interface LanguageStats {
  language: string;
  bytes: number;
  percentage: number;
}

Release Models

ReleaseInfo

GitHub release information.
tag_name
string
Git tag name (e.g., “v1.0.0”)
published_at
string
ISO timestamp when the release was published
name
string | null
Release name (null if not set)
isMajor
boolean
Whether this is a major version release (e.g., v2.0.0 vs v1.2.3)
export interface ReleaseInfo {
  tag_name: string;
  published_at: string;
  name: string | null;
  isMajor: boolean;
}

Snapshot Models

MonthlySnapshot

Month-by-month activity breakdown.
month
string
Month name (e.g., “Jan”, “Feb”)
commits
number
Commits in this month
prsMerged
number
Pull requests merged in this month
issuesOpened
number
Issues opened in this month
issuesClosed
number
Issues closed in this month
reviews
number
PR reviews performed in this month
stars
number
Stars gained in this month (repository wrapped only)
forks
number
Forks gained in this month (repository wrapped only)
trafficViews
number
Repository views in this month
trafficClones
number
Repository clones in this month
contributors
number
Unique contributors in this month
topRepos
array
Top repositories for this month (user wrapped only)
topLanguages
LanguageStats[]
Top languages used in this month
export interface MonthlySnapshot {
  month: string; // e.g., "Jan"
  commits: number;
  prsMerged: number;
  issuesOpened: number;
  issuesClosed: number;
  reviews: number;
  stars: number;
  forks: number;
  trafficViews?: number;
  trafficClones?: number;
  contributors: number;
  topRepos?: Array<{
    name: string;
    commits: number;
    prsMerged: number;
    issuesOpened: number;
  }>;
  topLanguages?: LanguageStats[];
}

Wrapped Data Models

WrappedData

Complete repository year-in-review data returned by /api/wrapped.
repository
RepositoryInfo
Repository metadata
year
number
The year this wrapped data covers
contributors
object
Contributor statistics
activity
CommitStats
Commit activity patterns
community
object
Community growth metrics
languages
LanguageStats[]
Programming language breakdown
releases
ReleaseInfo[]
Releases published this year
mostEditedFiles
array
Files with the most changes
monthly
MonthlySnapshot[]
Month-by-month breakdown
generatedAt
string
ISO timestamp when data was generated
export interface WrappedData {
  repository: RepositoryInfo;
  year: number;
  contributors: {
    topByCommits: Contributor[];
    topByLines: Contributor[];
    newContributors: number;
    mostActiveReviewer?: Contributor;
    total: number;
  };
  activity: CommitStats;
  community: {
    starsGained: number;
    forksGained: number;
    issuesOpened: number;
    issuesClosed: number;
    prsMerged: number;
    watchersGained: number;
  };
  languages: LanguageStats[];
  releases: ReleaseInfo[];
  mostEditedFiles: Array<{ path: string; changes: number }>;
  monthly?: MonthlySnapshot[];
  generatedAt: string;
}

UserWrappedData

Complete user year-in-review data returned by /api/wrapped/user, /api/performance, and /api/summary.
user
UserProfile
User profile information
year
number
The year this wrapped data covers
overview
object
High-level activity summary
hourlyActivity
Record<string, number>
Commits by hour of day (keys: “0” to “23”)
dailyActivity
Record<string, number>
Commits by day of week (keys: “Sunday” to “Saturday”)
streak
object
Contribution streak statistics
monthly
MonthlySnapshot[]
Month-by-month activity breakdown
topRepos
array
Most contributed repositories
generatedAt
string
ISO timestamp when data was generated
export interface UserWrappedData {
  user: UserProfile;
  year: number;
  overview: {
    totalCommits: number;
    totalPRs: number;
    totalIssues: number;
    topLanguages: LanguageStats[];
    busiestMonth: { month: string; count: number };
  };
  hourlyActivity: Record<string, number>; // "0" to "23"
  dailyActivity: Record<string, number>; // "Sunday" to "Saturday"
  streak: {
    longest: number;
    totalActiveDays: number;
    mostActiveDay: { date: string; count: number };
  };
  monthly?: MonthlySnapshot[];
  topRepos: {
    name: string;
    owner: { login: string };
    description: string | null;
    stars: number;
    language: string | null;
  }[];
  generatedAt: string;
}

Cache Models

CacheEntry

Internal cache structure (not exposed in API responses).
data
WrappedData | UserWrappedData
Cached wrapped data
expiresAt
number
Unix timestamp when cache entry expires
export interface CacheEntry {
  data: WrappedData | UserWrappedData;
  expiresAt: number;
}

Type Usage Examples

TypeScript Client

import type { WrappedData, UserWrappedData, RepositoryInfo } from '@/types';

async function fetchRepositoryWrapped(
  owner: string,
  repo: string,
  year: number
): Promise<WrappedData> {
  const response = await fetch(
    `/api/wrapped?owner=${owner}&repo=${repo}&year=${year}`
  );
  const { data } = await response.json();
  return data as WrappedData;
}

async function fetchUserWrapped(
  username: string,
  year: number
): Promise<UserWrappedData> {
  const response = await fetch(
    `/api/wrapped/user?username=${username}&year=${year}`
  );
  const { data } = await response.json();
  return data as UserWrappedData;
}

React Component with Types

import type { UserWrappedData } from '@/types';
import { useState, useEffect } from 'react';

function UserDashboard({ username }: { username: string }) {
  const [data, setData] = useState<UserWrappedData | null>(null);
  
  useEffect(() => {
    fetch(`/api/wrapped/user?username=${username}&year=2024`)
      .then(r => r.json())
      .then(result => setData(result.data));
  }, [username]);
  
  if (!data) return <div>Loading...</div>;
  
  return (
    <div>
      <h1>{data.user.name || data.user.username}</h1>
      <p>Commits: {data.overview.totalCommits}</p>
      <p>Longest streak: {data.streak.longest} days</p>
    </div>
  );
}

Source Code

All interfaces: types/index.ts

Repository Wrapped

See WrappedData in action

User Wrapped

See UserWrappedData in action

API Overview

General API documentation

Build docs developers (and LLMs) love