English | ไธญๆ
Turn your GitHub contributions into a Stardew Valley-style pixel farm
๐ฑ This project is early-stage and looking for contributors! If you think this idea is cool, star it, open an issue, or send a PR โ every bit of help counts. See CONTRIBUTING.md for how to get started.
GitHub Farm visualizes your GitHub contribution data as a Stardew Valley-style pixel farm:
- Commits = Crops - weekly contributions sorted left-to-right, growing from seed to harvest
- Trees = Languages - your top programming languages appear as trees on the grassland
- Animals = PRs - merged pull requests bring animals to your farm
- Decorations = Issues - issue participation adds flowers and decorations
Farm Scene โ crops grow from seed to harvest, left to right:
Sprite Sheet โ pixel-art assets for crops, trees, animals, buildings and tools:
npm install
npm run dev # Start dev server with live preview (mock data by default)To use real GitHub data, set your token:
# Windows PowerShell
$env:GITHUB_TOKEN="ghp_your_token_here"; npm run dev
# macOS / Linux
GITHUB_TOKEN=ghp_your_token npm run devThe dev server generates a PNG, starts a local HTTP server at http://localhost:3000, and opens your browser automatically. Edit code โ Ctrl+C โ npm run dev to refresh.
npm run build # Generate with mock data โ dist/farm.png
npm run build:real # Generate with real data (requires GITHUB_TOKEN)Add workflow to your username/username repo:
name: Generate Farm
on:
schedule:
- cron: '0 0 * * *'
workflow_dispatch:
jobs:
generate:
runs-on: ubuntu-latest
steps:
- uses: YeatsLiao/github-farm@main
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
output: farm.png
theme: stardew| GitHub Data | Farm Element | Description |
|---|---|---|
| Weekly contributions (sorted) | Crop growth stage | 5 stages: seed โ sprout โ growing โ tall โ harvest |
| Top programming languages | Trees | Each language = one tree, up to 5 |
| Merged PRs | Animals | 1 animal per 8 PRs, up to 5 |
| Issue participation | Decorations | 1 decoration per 6 issues, up to 4 |
| Streak โฅ 30 days | Scarecrow | Placed at field edge |
github-farm/
โโโ src/
โ โโโ index.js # Main entry + CLI
โ โโโ fetcher.js # GitHub GraphQL API + mock data
โ โโโ renderer.js # Canvas pixel-art renderer
โ โโโ farm-layout.js # Farm layout algorithm
โ โโโ themes/
โ โโโ stardew.js # Stardew Valley theme config
โโโ assets/
โ โโโ sprites/cropped/ # Individual pixel sprites (crops, trees, animals)
โ โโโ scenes/ # Background image
โโโ dev-server.mjs # Local dev server with live preview
โโโ dist/ # Build output (PNG)
โโโ docs/
โ โโโ PRD.md # Product requirements
โ โโโ ARCHITECTURE.md # Architecture design
โ โโโ DEVLOG.md # Dev notes & pitfalls
โโโ package.json
- Node.js - Runtime
- Canvas (npm
canvas) - Pixel-art PNG rendering - GitHub GraphQL API - Contribution data
- GitHub Actions - Automation (planned)
- Canvas pixel-art renderer
- 5-stage crop system with sorted column layout
- Trees, animals, decorations from GitHub stats
- Local dev server with live preview
- GitHub Action wrapper
- Multi-theme support (4 seasons)
- Online preview/config tool
| Doc | Description |
|---|---|
| PRD.md | Product requirements โ features, user scenarios, competitors |
| ARCHITECTURE.md | Architecture โ module design, data flow, extension points |
| DEVLOG.md | Dev log โ renderer iterations, pitfalls |
MIT (c) YeatsLiao
