Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

A self-hosted drop-in replacement for [CounterAPI](https://counterapi.com) built on [Cloudflare Workers](https://workers.cloudflare.com/) + [KV](https://developers.cloudflare.com/kv/). CounterAPI went down in May 2026 without notice; this gives you the same API surface on infrastructure you own.

![CounterAPI Worker README views](https://counter.avikalp.workers.dev/api/github.com/avikalpg/counterapi-worker/views/readme?format=svg&label=README%20views)
![CounterAPI Worker README views](https://counter.avikalp.workers.dev/api/github.com/views/avikalpg/counterapi-worker/readme?format=svg&label=README%20views)

This README uses the Worker above to count its own views. Dogfooding matters: the Markdown badge is a normal request to the hosted Worker, not a static screenshot.

Expand All @@ -25,11 +25,16 @@ GET /api/{namespace}/views/{key}
```
Auto-increments on each request and returns `{ value, iconSvg }`.

For an embeddable SVG badge:
For a generic Markdown badge, use any namespace and key:
```md
![views](https://counter.YOUR_SUBDOMAIN.workers.dev/api/your-site.com/views/page-key?format=svg&label=views)
```

For a GitHub repository README badge, use `github.com` as the namespace and keep the repository slug in the key:
```md
![README views](https://counter.YOUR_SUBDOMAIN.workers.dev/api/github.com/views/OWNER/REPO/readme?format=svg&label=README%20views)
```

### Like counter (read)
```
GET /api/{namespace}/vote/{key}?readOnly=true
Expand Down Expand Up @@ -82,7 +87,7 @@ fetch(`https://counter.YOUR_SUBDOMAIN.workers.dev/api/your-site.com/views/page-k

That's it. The response shape is identical.

For GitHub READMEs or HTML image badges, use the SVG format:
For HTML image badges, use the SVG format:
```html
<img src="https://counter.YOUR_SUBDOMAIN.workers.dev/api/your-site.com/views/page-key?format=svg&label=views" alt="Views" />
```
Expand Down
Loading