|
| 1 | +# GitWidgets |
| 2 | + |
| 3 | +[](https://github.com/gitwidgets-org/gitwidgets/actions/workflows/ci.yml) |
| 4 | +[](LICENSE) |
| 5 | +[](https://pnpm.io) |
| 6 | + |
| 7 | +> Dynamic SVG widgets for GitHub READMEs — stats, streak, top languages, and more. |
| 8 | +> One engine. Three delivery channels. Zero lock-in. |
| 9 | +
|
| 10 | +--- |
| 11 | + |
| 12 | +## Widgets |
| 13 | + |
| 14 | +| Widget | Status | Preview | |
| 15 | +|---|---|---| |
| 16 | +| **Stats card** | ✅ Live | `GET /api/stats.svg?username=<user>` | |
| 17 | +| Streak | 🚧 Coming soon | — | |
| 18 | +| Top Languages | 🚧 Coming soon | — | |
| 19 | +| Activity Graph | 🚧 Coming soon | — | |
| 20 | + |
| 21 | +### Stats card |
| 22 | + |
| 23 | +``` |
| 24 | +https://gitwidgets.dev/api/stats.svg?username=senavictors |
| 25 | +``` |
| 26 | + |
| 27 | +Parameters: |
| 28 | + |
| 29 | +| Param | Default | Description | |
| 30 | +|---|---|---| |
| 31 | +| `username` | required | GitHub username | |
| 32 | +| `theme` | `dark` | `dark` \| `light` \| `glass` \| `minimal` | |
| 33 | +| `hide` | `[]` | Comma-separated: `stars,commits,prs,issues,contribs` | |
| 34 | +| `show_icons` | `true` | Show stat icons | |
| 35 | +| `include_all_commits` | `false` | Count all-time commits (slower) | |
| 36 | + |
| 37 | +--- |
| 38 | + |
| 39 | +## Delivery channels |
| 40 | + |
| 41 | +### 1. Public API (zero setup) |
| 42 | + |
| 43 | +Paste a URL in your README ``. |
| 44 | + |
| 45 | +### 2. GitHub Action (self-hosted, no runtime dependency) |
| 46 | + |
| 47 | +```yaml |
| 48 | +- uses: gitwidgets-org/gitwidgets@v1 |
| 49 | + with: |
| 50 | + username: ${{ github.repository_owner }} |
| 51 | + github_token: ${{ secrets.GITHUB_TOKEN }} |
| 52 | +``` |
| 53 | +
|
| 54 | +### 3. Web Dashboard |
| 55 | +
|
| 56 | +Visit [gitwidgets.dev](https://gitwidgets.dev) to build URLs visually and preview your widgets live. |
| 57 | +
|
| 58 | +--- |
| 59 | +
|
| 60 | +## Development |
| 61 | +
|
| 62 | +**Requirements:** Node ≥ 20, pnpm ≥ 9 |
| 63 | +
|
| 64 | +```bash |
| 65 | +git clone https://github.com/gitwidgets-org/gitwidgets |
| 66 | +cd gitwidgets |
| 67 | +pnpm install |
| 68 | + |
| 69 | +# Run the Worker locally |
| 70 | +cd apps/api |
| 71 | +echo "GITHUB_TOKEN=ghp_..." > .dev.vars |
| 72 | +pnpm wrangler dev --local |
| 73 | +# → http://localhost:8787/api/stats.svg?username=torvalds |
| 74 | +``` |
| 75 | + |
| 76 | +### Common commands |
| 77 | + |
| 78 | +```bash |
| 79 | +pnpm dev # start all apps in watch mode |
| 80 | +pnpm test # vitest across all packages |
| 81 | +pnpm typecheck # tsc --noEmit |
| 82 | +pnpm lint # biome lint |
| 83 | +pnpm build # turbo build (core + worker bundle) |
| 84 | +``` |
| 85 | + |
| 86 | +### Monorepo layout |
| 87 | + |
| 88 | +``` |
| 89 | +gitwidgets/ |
| 90 | +├── apps/ |
| 91 | +│ ├── api/ # Cloudflare Worker — public SVG API |
| 92 | +│ ├── dashboard/ # Next.js — playground and public profiles |
| 93 | +│ └── docs/ # Nextra — docs site |
| 94 | +└── packages/ |
| 95 | + ├── core/ # Engine — domain, renderers, fetchers, themes |
| 96 | + ├── action/ # GitHub Action wrapper |
| 97 | + ├── sdk/ # JS/TS SDK |
| 98 | + ├── tsconfig/ # Shared TS configs |
| 99 | + └── biome-config/ # Shared Biome config |
| 100 | +``` |
| 101 | + |
| 102 | +All business logic lives in `packages/core`. The apps are thin shells. |
| 103 | + |
| 104 | +--- |
| 105 | + |
| 106 | +## Architecture decisions |
| 107 | + |
| 108 | +See [`docs/adr/`](docs/adr/) for the full ADR log. |
| 109 | + |
| 110 | +Key decisions: Cloudflare Workers for edge rendering, Hono for the HTTP layer, SVG template strings (no WASM), `tsup` for path-alias-aware bundling. Details in [ADR-0001](docs/adr/0001-stack-decisions.md). |
| 111 | + |
| 112 | +--- |
| 113 | + |
| 114 | +## Contributing |
| 115 | + |
| 116 | +1. Fork → branch → PR against `main` |
| 117 | +2. `pnpm lint && pnpm typecheck && pnpm test` must pass |
| 118 | +3. One feature per PR; include or update tests |
| 119 | + |
| 120 | +--- |
| 121 | + |
| 122 | +## License |
| 123 | + |
| 124 | +`packages/core`, `apps/api`, `apps/docs`, `packages/action`, `packages/sdk` — **MIT** |
| 125 | +`apps/dashboard` — **AGPL-3.0** |
0 commit comments