Kounter is a simple counter service that can be used in various ways.
Use cases include a profile views counter, repository visits counter, or anything you want to count.
For development, you must set the DETA_PROJECT_KEY environment variable to your Deta project key.
This project uses Bun for development.
bun devKounter is built using Fastify.
It has a straightforward API with the following few endpoints.
Note
You can also check the Swagger API documentation for more details.
Base URL: https://kounter.kerolloz.dev
Redirects to this repository.
- Increments the counter by 1 if
:keyexits; creates a new counter with count initialized to 1 otherwise. - Returns a shields.io badge (SVG image) for your counter.
key- The key of the counter to increment.
silent- Set totrueto disable incrementing the counter. Defaults tofalse.style- Set the style of the badge. Can be one offlat,flat-square,for-the-badge, orplastic. Defaults toflat.label- Set the left-hand-side text. Defaults to:key.color- Set the background of the right part (hex, rgb, rgba, hsl, hsla and css named colors supported). Defaults tobrightgreen.labelColor- Set the background of the left part (hex, rgb, rgba, hsl, hsla and css named colors supported). Defaults togrey.cntPrefix- Set prefix to display before the counter value. Defaults to""empty string.cntSuffix- Set suffix to display after the counter value. Defaults to""empty string.




- Returns the current count for
:keywithout incrementing it. - Returns
{ key: ":key", count: 0 }if the counter:keydoes not exist.
key- The key of the counter to get count value for.
$ curl -X GET https://kounter.kerolloz.dev/count/xyz
{
"count": 1,
"key": "xyz"
}