• Townie
    AI
  • Blog
  • Docs
  • Pricing
  • We’re hiring!
Log inSign up
Jamesllllllllll

Jamesllllllllll

like-anything

Add a "Like" button anywhere on the web
Remix of maxm/ipv4-counter
Public
Like
like-anything
Home
Code
11
.claude
1
backend
1
frontend
1
.vtignore
CLAUDE.md
PAGE_LIKES_DOCUMENTATION.md
README.md
deno.json
H
index.ts
script.js
test-embed.html
Branches
1
Pull requests
Remixes
History
Environment variables
1
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.
Sign up now
Code
/
README.md
Code
/
README.md
Search
8/17/2025
README.md

Likes Tracking API

A cross-origin API service that tracks likes using unique IDs.

Features

  • Simple ID-based tracking - Use any unique identifier (blog posts, products, comments, etc.)
  • Embeddable widget - Drop-in script that creates beautiful like buttons
  • Real-time updates - Like counts update instantly across all websites
  • CORS enabled - Works from any website or domain
  • SQLite storage - Reliable, persistent data storage

Quick Start

1. Add the script to your page

<script src="https://jamesllllllllll--019894a514b47659ac14319f8b619533.web.val.run/script.js"></script>

2. Add a likes widget anywhere on your page

<div data-likes-id="your-unique-id"> <button class="likes-button">❤️ <span class="likes-count">0</span></button> </div>

💡 Customize the emoji: Change ❤️ to any emoji you want: 👍 🎉 🚀 ⭐ 🎯 🏆 🎊 🎈 🎁

3. Done!

  • Loads current like count automatically
  • Handles button clicks to record likes
  • Updates count in real-time
  • Supports multiple IDs on one page

API Endpoints

POST /api/like

Record a like for a specific ID:

{ "id": "life-universe-everything" }

Returns:

{ "success": true, "id": "life-universe-everything", "likeCount": 42 }

GET /api/likes/:id

Get like count for a specific ID:

GET /api/likes/post-123

Returns:

{ "id": "post-123", "likeCount": 42 }

GET /api/likes

Get total likes across all IDs (for fun)

Use Cases

  • Blog posts: Use post IDs like "post-123" or "2024-01-15-intro"
  • Products: Use product IDs like "product-abc" or "laptop-xps-13"
  • Comments: Use comment IDs like "comment-456" or "reply-789"
  • Custom: Any unique identifier you want to track likes for!

Example Usage

Basic like tracking

// Get current likes for a post fetch('https://jamesllllllllll--019894a514b47659ac14319f8b619533.web.val.run/api/likes/post-123') .then(res => res.json()) .then(data => { document.querySelector('.likes-count').textContent = data.likeCount; }); // Record a like fetch('https://jamesllllllllll--019894a514b47659ac14319f8b619533.web.val.run/api/like', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ id: 'post-123' }) }) .then(res => res.json()) .then(data => { // Update the likes count });

Project Structure

├── backend/
│   └── database.ts          # SQLite database setup and queries
├── frontend/
│   └── index.html           # Documentation & demo
├── script.js                # Embeddable likes widget script
├── index.ts                 # Main HTTP handler using Hono
└── README.md                # This file
FeaturesVersion controlCode intelligenceCLI
Use cases
TeamsAI agentsSlackGTM
DocsShowcaseTemplatesNewestTrendingAPI examplesNPM packages
PricingNewsletterBlogAboutCareers
We’re hiring!
Brandhi@val.townStatus
X (Twitter)
Discord community
GitHub discussions
YouTube channel
Bluesky
Open Source Pledge
Terms of usePrivacy policyAbuse contact
© 2025 Val Town, Inc.