This project is a port of the Friends of Shopware API to Cloudflare Workers, using TypeScript and Hono as the web server framework.
- GitHub repositories listing
- Contributors listing
- Repository issues listing
- Packagist packages information
- GitHub webhook for issue updates
- Data cached in Cloudflare KV storage
- Uses Cloudflare Queues for rate-limited GitHub API operations
- Install dependencies:
npm install- Configure your KV namespace and Queue:
Create a KV namespace and a Queue in your Cloudflare Workers dashboard and update the wrangler.toml file with your IDs.
kv_namespaces = [
{ binding = "STORAGE", id = "your-kv-namespace-id", preview_id = "your-preview-kv-namespace-id" }
]
[[queues.producers]]
queue = "github-tasks"
binding = "GITHUB_QUEUE"
[[queues.consumers]]
queue = "github-tasks"
max_batch_size = 10
max_batch_timeout = 30
max_retries = 3- Set your GitHub token:
Create a GitHub personal access token with the necessary permissions to access repositories and update the wrangler.toml file:
[vars]
GITHUB_TOKEN = "your-github-token"
ORG_NAME = "friendsofshopware"Run the development server:
npm run devDeploy to Cloudflare Workers:
npm run deployGET /v2/github/repositories- List all repositoriesGET /v2/github/contributors- List all contributorsGET /v2/github/issues/:plugin- List issues for a specific pluginGET /v2/packagist/packages- List all packagesPOST /webhook/issue- GitHub webhook for issue updates
The project uses Cloudflare Queues to manage GitHub API requests. This helps to:
- Respect GitHub API rate limits
- Make API interactions more resilient
- Process tasks asynchronously
Tasks are dispatched to the queues during cron jobs:
- Hourly: Refresh GitHub stats and Packagist stats
- Every 5 minutes: Refresh repository issues
The application uses Cloudflare Cron Triggers to perform these tasks:
0 * * * *(Hourly): Refresh GitHub stats and Packagist stats*/5 * * * *(Every 5 minutes): Refresh repository issues
MIT