This document provides comprehensive details about how the GitHub Package service utilizes various GitHub APIs to discover and process developer profiles for the Brainy knowledge graph.
Purpose: Provides a reliable starting point for data collection using authenticated user's network.
APIs Used:
GET /user- Fetch authenticated user detailsGET /users/{username}/followers- Get user's followersGET /user/starred- Get repositories starred by userGET /users/{username}- Get full user details for discovered profiles
Benefits:
- 100% Reliability: Always starts with authenticated user (guaranteed to exist)
- Network Effect: Leverages social graph for organic discovery
- Quality Signal: Followers and starred repos indicate engaged developers
- Rate Limit Efficient: Uses core API endpoints (5000 req/hour)
Implementation:
private async bootstrapDiscovery(): Promise<void> {
// 1. Process authenticated user
// 2. Process user's followers (limit 10)
// 3. Process owners of starred repositories (limit 5)
}Purpose: Find developers actively contributing to open source projects.
APIs Used:
GET /events- Public events stream (real-time activity)GET /users/{username}- Get full details for active users
Benefits:
- Real-Time Data: Captures currently active developers
- Quality Filter: Focus on meaningful contributions (Push, PR, Create, Release events)
- Fresh Profiles: Discovers new and emerging contributors
- High Engagement: Active users more likely to have rich profiles
Event Types Monitored:
PushEvent- Code commitsPullRequestEvent- Code reviews and contributionsCreateEvent- New repositories/branchesReleaseEvent- Project releases
Purpose: Find high-quality developers using advanced search criteria.
APIs Used:
- GraphQL endpoint with search queries
- Combined filters for repositories, followers, and activity
Methods:
# Find Productive Developers
search(query: "type:user repos:>10 followers:>50", type: USER)
# Find Versatile Developers
search(query: "type:user repos:>2 followers:>5", type: USER)
# Find Influential Developers
search(query: "type:user followers:>200", type: USER)Benefits:
- Bulk Discovery: Returns multiple users in single request
- Quality Filters: Pre-filters for active, influential developers
- Efficient: Single request for multiple profiles
- Flexible: Can adjust criteria based on needs
| API Type | Limit | Reset | Our Usage |
|---|---|---|---|
| Core/REST | 5,000/hour | Hourly | Bootstrap, User details |
| GraphQL | 5,000/hour | Hourly | Search queries |
| Search | 30/minute | Per minute | GraphQL search |
-
Intelligent Caching
- Cache user data to avoid repeated fetches
- Store rate limit info to optimize request timing
-
Batch Processing
- Use GraphQL for bulk user discovery
- Process users in controlled batches
-
Prioritization
- Focus on high-quality profiles first
- Skip inactive or low-value accounts
-
Error Handling
- Graceful degradation on rate limit
- Automatic retry with exponential backoff
- Continue other discovery methods if one fails
Bootstrap → Active Contributors → GraphQL Search
processUser(user) {
1. Fetch complete user profile
2. Fetch user's repositories
3. Analyze skills and technologies
4. Detect job-seeking signals
5. Calculate quality scores
}processRepository(repo) {
1. Extract languages and technologies
2. Analyze README for skills
3. Check activity levels
4. Identify key contributions
}storeInBrainy(data) {
1. Transform to standardized schema
2. Create nouns (entities)
3. Create verbs (relationships)
4. Handle placeholders for missing data
}- Multi-source validation: Cross-reference data from multiple APIs
- Fresh data: Real-time event stream ensures current information
- Rich profiles: Multiple data points per developer
- Guaranteed starting point: Bootstrap with authenticated user
- Network expansion: Organic growth through social connections
- Active discovery: Find new contributors as they emerge
- Rate limit aware: Intelligent request management
- Batch operations: Minimize API calls
- Graceful degradation: Continue operating even with limits
# GitHub Authentication
GITHUB_TOKEN=your_token # Personal access token
# OR GitHub App (higher rate limits)
GITHUB_APP_ID=your_app_id
GITHUB_PRIVATE_KEY=your_private_key
GITHUB_INSTALLATION_ID=your_installation_id
# Discovery Configuration
AUTO_START_PROCESSING=true # Auto-start discovery
PROCESSING_MODE=continuous # continuous or single
RATE_LIMIT_THRESHOLD=50 # Stop when X requests remain// In githubService.ts
const DISCOVERY_LIMITS = {
bootstrapFollowers: 10, // Followers to process
bootstrapStarred: 5, // Starred repo owners
activeContributors: 15, // Active users from events
graphqlBatchSize: 100, // Users per GraphQL query
}- Users processed per hour
- API rate limit consumption
- Discovery method success rates
- Error rates by API endpoint
GET /health- Service health and initialization statusGET /api/data-status- Processing statisticsGET /rate-limits- Current GitHub API limitsGET /stats- Detailed processing metrics
-
Rate Limit Exceeded
- Automatic pause until reset
- Switch to different API endpoint
- Continue with cached data
-
Authentication Failure
- Verify token/app credentials
- Check token permissions
- Fallback to public API endpoints
-
Network Timeouts
- Retry with exponential backoff
- Continue with other discovery methods
- Log for later reprocessing
-
Storage Throttling
- Batch writes to reduce frequency
- Implement queue with rate limiting
- Use write-only mode for efficiency
- Organization Discovery - Process entire organizations
- Topic-Based Search - Find developers by technology topics
- Contribution Analysis - Deep dive into commit history
- Team Discovery - Find collaborative developer groups
- Trending Developer - Identify rising stars
/users/{username}/events- User's public activity/repos/{owner}/{repo}/contributors- Repository contributors/search/users- Advanced user search/users/{username}/following- Who user follows- Webhooks API - Real-time event processing
The GitHub Package service uses a multi-layered approach to discover and process developer profiles:
- Reliability First: Bootstrap discovery ensures we always have data to process
- Quality Over Quantity: Focus on active, engaged developers
- Efficient API Usage: Maximize value from rate limits
- Graceful Degradation: Continue operating despite failures
- Rich Data Collection: Multiple data points per developer
This approach ensures consistent data flow into the Brainy knowledge graph while respecting GitHub's API limits and maintaining high data quality.