A dynamic, visually appealing dashboard for GitHub starred repositories that supports multiple usernames. Features Ruby backend data generation with JavaScript frontend, GitHub Pages compatibility, and automated data updates via GitHub Actions.
- π¨ Beautiful UI: Modern, responsive dashboard with Bootstrap styling
- π€ Multi-user Support: Enter any GitHub username to view their starred repos
- π·οΈ Language Grouping: Repositories organized by programming language with color-coded badges
- π Rich Metadata: Shows stars, topics, reading time estimates, and last updated dates
- π GitHub Pages Ready: Deploy as a static site with optional dynamic data generation
- π Auto-Updates: GitHub Actions workflow for automated data refresh
- π§ͺ Fully Tested: Comprehensive test suites for both Ruby and JavaScript code
Simply open index.html in your browser to see the dashboard with sample data.
-
Clone the repository
git clone <your-repo-url> cd github-ruby-project
-
Install Ruby dependencies
bundle install
-
Set up your GitHub token
cp .env.example .env # Edit .env and add your GitHub token -
Generate data for a user
ruby fetch-starred.rb your-github-username
-
Serve the dashboard
python3 -m http.server 8000 # Open http://localhost:8000 in your browser
github-ruby-project/
βββ π index.html # Main dashboard page
βββ π script.js # Dashboard JavaScript logic
βββ π github-api.js # GitHub API integration
βββ π fetch-starred.rb # Ruby data fetcher
βββ π Gemfile # Ruby dependencies
βββ π .env # Environment variables (create from .env.example)
βββ π config.example.js # JavaScript config template
βββ π§ͺ simple_test.rb # Ruby backend tests
βββ π§ͺ test_frontend.js # JavaScript command-line tests
βββ π§ͺ test_frontend.html # Interactive browser tests
βββ π output/ # Generated JSON data files
β βββ starred_grouped_<user>.json
β βββ starred_<user>.json
βββ π .github/workflows/ # GitHub Actions automation
βββ generate-user-data.yml
- Ruby 3.0+
- Node.js (for frontend tests)
- GitHub Personal Access Token
Create .env file:
cp .env.example .envAdd your GitHub token to .env:
GITHUB_TOKEN=your_github_personal_access_token_hereGet a GitHub token:
- Go to GitHub Settings β Developer settings β Personal access tokens
- Generate new token with
public_reposcope - Copy the token to your
.envfile
Ruby dependencies:
bundle installFor testing (optional):
# Node.js should be installed for frontend tests
node --versionFor local development with dynamic features:
// Copy config.example.js to config.js
cp config.example.js config.js
// Edit config.js:
window.GITHUB_CONFIG = {
owner: 'your-github-username',
repo: 'your-repository-name',
token: 'your_github_token' // Only for local development!
};For GitHub Pages deployment:
// In config.js (or keep config.example.js):
window.GITHUB_CONFIG = {
owner: 'your-github-username',
repo: 'your-repository-name',
token: null // Always null for production!
};# Generate data for a specific user
ruby fetch-starred.rb octocat
# Generate data for yourself (default)
ruby fetch-starred.rbThis creates JSON files in the output/ directory:
starred_grouped_<username>.json- Repositories grouped by languagestarred_<username>.json- Flat list of repositories
Local development:
# Serve files over HTTP (required for JavaScript to work)
python3 -m http.server 8000
# or
ruby -run -e httpd . -p 8000
# Open http://localhost:8000 in your browserGitHub Pages:
- Push your repository to GitHub
- Enable GitHub Pages in repository settings
- Your dashboard will be available at
https://username.github.io/repository-name
- Enter a username in the form at the top
- Click "Load Repositories" to fetch data
- View organized repos grouped by programming language
- Click repository names to visit them on GitHub
# Run Ruby tests
ruby simple_test.rbTests cover:
- Reading time estimation
- Language color validation
- Data structure validation
Command line tests:
# Run JavaScript tests with Node.js
node test_frontend.jsInteractive browser tests:
# Open in browser
open test_frontend.html
# Click "Run All Tests" buttonFrontend tests cover:
- HTML generation functions
- Username validation
- Date formatting
- JSON data processing
- Error handling
- URL validation
- DOM manipulation
β
Ruby Tests: 34 passed, 0 failed
β
JavaScript Tests: 69 passed, 0 failed
The repository includes a GitHub Actions workflow that can generate user data automatically:
Workflow file: .github/workflows/generate-user-data.yml
Manual trigger:
- Go to Actions tab in your GitHub repository
- Select "Generate User Data" workflow
- Click "Run workflow"
- Enter the username you want to generate data for
API trigger (from JavaScript): The dashboard can automatically trigger the workflow when data for a user doesn't exist.
-
Add GitHub token as repository secret:
- Go to Settings β Secrets and variables β Actions
- Add new secret:
GITHUB_TOKENwith your personal access token
-
Enable workflow permissions:
- Go to Settings β Actions β General
- Set "Workflow permissions" to "Read and write permissions"
Edit the LANGUAGE_COLORS constant in fetch-starred.rb:
LANGUAGE_COLORS = {
"Ruby" => "#701516",
"YourLanguage" => "#your-hex-color",
# ... other languages
}The dashboard uses Bootstrap 5.3.0. Customize by:
- Editing CSS in
index.html - Modifying the HTML generation in
script.js - Updating the card templates
To add new data fields, update:
fetch-starred.rb- Add fields to the data structurescript.js- Update HTML generation to display new fields- Tests - Add validation for new fields
- Push to GitHub
- Enable Pages: Settings β Pages β Source: Deploy from branch β main
- Pre-generate data: Run
ruby fetch-starred.rb usernamefor expected users - Commit JSON files: Add generated files to repository
- Access:
https://username.github.io/repository-name
The dashboard works on any static hosting service:
- Netlify
- Vercel
- GitHub Pages
- Firebase Hosting
- Any web server
- Never commit
.envfiles - Contains your GitHub token - Use
token: nullin production - Keep tokens out of client-side code - Use repository secrets - For GitHub Actions workflows
- Limit token permissions - Only grant necessary scopes (
public_repo)
Problem: JavaScript can't load JSON files
Solution: Serve files over HTTP, not file:// protocol
python3 -m http.server 8000Problem: JSON files don't exist for the requested user
Solution: Generate data first
ruby fetch-starred.rb usernameProblem: Too many API requests
Solution:
- Use authenticated requests (add GitHub token)
- Wait for rate limit reset
- Cache generated JSON files
Problem: Tests hang or timeout
Solution:
- Check internet connection
- Verify GitHub token is valid
- Run simpler tests first:
ruby simple_test.rb
- Fork the repository
- Create a feature branch:
git checkout -b feature-name - Make your changes
- Run tests:
ruby simple_test.rb && node test_frontend.js - Commit changes:
git commit -am 'Add feature' - Push to branch:
git push origin feature-name - Submit a Pull Request
This project is open source and available under the MIT License.
- GitHub API for providing repository data
- Bootstrap for UI components
- Ruby HTTParty for HTTP requests
- GitHub Actions for automation