Skip to content
This repository has been archived by the owner on Dec 7, 2020. It is now read-only.


Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time

Meddelare Social Buttons Standalone Node.js Server meddelare-node-server

⚠️ The Meddelare Social Buttons project has been shut down as of 2020-12-07. No updates will be made and the source code will possibly be deleted in the future. Please download what you need as soon as possible.

Install custom social share counters on your website with your own hosted solution, which only makes a single API request and loads minimal or zero assets to display the counters.

A screenshot of the button example

Check out and view examples on

Standalone Node.js server

This is an open source and self-hosted alternative to sharing services such as AddThis and ShareThis. Because you run the proxy server yourself, you are also defending your users' privacy against the social networks' tracking. Users only opt in to their tracking once they decide to click a share button -- never implicitly just because they visited your page.


  • Completely customizable user interface design -- use layout, logotypes, animations of your own choice.
  • A single API call to get counts from multiple social networks, delivered as JSON or JSONP.
  • Calls social networks in parallel from the server, making it (approximately) as fast to get the count from one as several at once.
  • No third party resources required – you can host both the social buttons server and any resources yourself.
  • Blocks social networks' user tracking by proxying calls until the user decides to click a share button.
  • Super-fast in-memory cache keeps the most recent results per network and url.
  • Easy to deploy and prepared for content delivery network (CDN) proxies.

Getting started

# Clone the repository
git clone

cd meddelare-node-server

# Install dependencies
npm install

# Run the server
node app/server.js


See this example API call. The response is delivered as JSON, or JSONP if you specify a callback.

  "facebook": 5281,
  "googleplus": 42,
  "twitter": 8719

HTML Widgets

View examples on

We would love to feature your widget design!
Please submit your design in a pull request to meddelare-examples and we will add it to our list.

You can do anything you want to display your share counts when using the API. Below is a very simple example showing the count per network -- see this example API call with text. Note that we are using a CloudFront distribution domain in the examples.

<!DOCTYPE html>
    <span id="twitter"></span>
    <span id="facebook"></span>
    <h3>Google Plus</h3>
    <span id="googleplus"></span>

    <script src=""></script>
      var url = "";
      var encoded = encodeURIComponent(url);
      var networks = ["facebook" , "twitter" , "googleplus"];

      $.ajax("" + networks.join(",") + "&url=" + encoded, {
        success: function (res, err) {
          $.each(res, function (network, value) {
            $("#" + network).text(value);


Options are passed using query parameters in the url.

Currently Twitter, Facebook and Google Plus are supported.

Use the networks query parameter to specify which ones you want to use as a comma-separated list (no spaces), for example networks=facebook,twitter,googleplus or networks=facebook.

Url (optional)
Use the url parameter to specify the address which you want to retrieve the number of shares for, for example

  • The value needs to be URL-encoded.
    • This prevents problems when looking up values for pages with, for example, parameters separated by &.
    • For example becomes when using javascript: encodeURIComponent("").
  • You can use your domain root, or a more specific url pointing to a specific page.

If you don't specify a url then the server will try to get the referring url's (HTTP Referer header) share count. This makes it easy to dynamically get the counts for the page currently open in the browser.

Callback (optional)
Specify the callback parameter to have the results delivered as JSONP instead of plain JSON.


Configure the node.js server instance at launch time. Where you set the environment variable depends on your system, but examples below are using the command line.

HTTP cache time
The environment variable CACHE_TIME can be used to set the time, in seconds, that the browser (or CDN) should cache results. Cached results vary on the request query string. To set the HTTP cache to ten minutes, use CACHE_TIME=600 node app/server.js.

Note that the in-memory cache is handled in an underlying layer and configured separately; this currently requires modifying the source code to pass the correct options.

Cross-domain requests
The server has cross-origin resource sharing (CORS) enabled for whitelisted domains, which need to be configured. Set the environment variable DOMAIN_WHITELIST to a list of comma-separated (no spaces) protocols+domains which are allowed to use your (private) meddelare-node-server instance.

This example whitelists domains Meddelare uses: DOMAIN_WHITELIST=',,,' node app/server.js

Content delivery networks (CDN)

If you want to reduce your server load it would be wise to throw up a cache, such as CloudFront, in front.

In CloudFront, just make sure you to inherit cache control directives from the server, enable query string forwarding and whitelist Origin HTTP headers. Either use your CloudFront distribution domain to access the API server or CNAME it with a custom domain of your choice.


Many thanks goes out to Taskforce for their social-buttons-server (released into the Public Domain) -- especially the creator @thomasdavis and contributor @beaugunderson. This software, meddelare-node-server, is based on their work.

Copyright (c) 2015 Team Meddelare All rights reserved.

When using meddelare-node-server, comply to the MIT license.


Install custom social share counters on your website with your own hosted solution, which only makes a single API request and loads minimal or zero assets to display the counters.







No packages published