tinycounter is a web service that provides customizable hit counters as images. It uses Redis for storage and supports different styles for the counter images.
- No client-side JavaScript required for end users.
- Embed counters with an HTML
<img>tag; unique visits are tracked by IP address with a cooldown for incrementing counters.
- Embed counters with an HTML
- Retrieve hit counter images for different users.
- Store and retrieve counter images in various styles.
- Uses Redis for fast and efficient storage.
You can run tinycounter using Docker and Docker Compose. Here's how to get started in a development environment:
-
Clone the repository:
git clone https://github.com/mn6/tinycounter.git cd tinycounter -
Create a
.envfile based on the.env.examplefile:cp .env.example .env
-
Update the
.envfile with your desired configuration. Update theusers.yamlif you want to set up whitelists or blacklists for user creation. -
Start the services using Docker Compose:
docker compose up -d
-
Access your counter image at
http://localhost:{APP_PORT}/{style}/{counter id/name}.
To add a new style for the counter images, follow these steps:
- Create a new directory under
resources/styles/with the name of your style (e.g.,my-style). - Add digit images (
0.pngto9.png) for your style in the new directory. Optionally, addpre.pngandsuf.pngfor prefix and suffix images. All images should be in PNG format and have the same height. Images will be stitched together horizontally to form the final counter image. - Update the
styles.yamlconfiguration file to include your new style. Width and height should match the dimensions of your digit images. SuffixWidth and PrefixWidth should match the widths of your suffix and prefix images, respectively. - Restart the
tinycounterservice to load the new style.