explaingit

mastodon/webpush

Analysis updated 2026-07-05 · repo last pushed 2025-01-13

2RubyAudience · developerComplexity · 2/5StaleSetup · moderate

TLDR

A Ruby gem that sends push notifications from a Ruby backend straight to a user's web browser, handling the encryption and delivery so your app can reach users even when they are not on your site.

Mindmap

mindmap
  root((repo))
    What it does
      Sends browser push notifications
      Encrypts messages
      Handles Web Push Protocol
    Tech stack
      Ruby
      JavaScript
      Service Workers
    Use cases
      Task assignment alerts
      Back-in-stock notices
      Re-engage users
    Key features
      VAPID key support
      GCM API key support
      Browser-side JS examples
    Audience
      Ruby web developers
      Web app builders
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Send a push notification to a user when a new task is assigned to them in a project management app.

USE CASE 2

Notify a shopper that an item they saved is back in stock.

USE CASE 3

Re-engage users with timely updates even when they are not actively viewing your website.

USE CASE 4

Set up browser-side push subscriptions using the included JavaScript service worker examples.

What is it built with?

RubyJavaScriptService Workers

How does it compare?

mastodon/webpushjoshuakgoldberg/mastodonsnatchev/deliver
Stars2
LanguageRubyRubyRuby
Last pushed2025-01-132024-05-112015-11-24
MaintenanceStaleDormantDormant
Setup difficultymoderatehardmoderate
Complexity2/54/52/5
Audiencedeveloperops devopsdeveloper

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · moderate Time to first run · 30min

Requires coordinating server-side Ruby setup with browser-side JavaScript service worker registration and subscription, which is a multi-step process.

The explanation does not mention a license, so the terms of use are unclear.

In plain English

The webpush gem lets a Ruby backend send push notifications straight to a user's web browser, even when that person isn't actively looking at your website. It handles the heavy lifting of the Web Push Protocol, including the encryption required to securely deliver messages to browsers like Chrome, Firefox, and Edge. At a high level, making web push notifications work requires coordination between the server and the browser. On the browser side, the user's device runs a small background script called a service worker, which listens for incoming push events. When the user agrees to receive notifications, the browser generates a unique subscription containing encryption details. The backend then uses this gem to package a message, encrypt it using those details, and send it to the browser's push service, which delivers the notification to the user's screen. This tool is designed for Ruby developers building web applications who want to re-engage their users with timely updates. For example, a project management app could use it to alert a user that a new task has been assigned to them, or an e-commerce site could notify a shopper that an item they saved is back in stock. It provides the server-side glue needed to bridge the gap between a Ruby application and the browser's built-in notification system. A notable aspect of this project is its support for VAPID, a standard that lets servers identify themselves to browser push services without relying on third-party API keys. The gem can generate these VAPID keys for you, though it also supports older methods like using Google's GCM API keys. The README provides extensive JavaScript examples for the browser-side setup, acknowledging that getting a service worker properly registered and subscribed is a multi-step process that happens entirely outside of the Ruby code.

Copy-paste prompts

Prompt 1
Using the webpush gem in a Rails app, write the Ruby controller action that takes a browser push subscription, encrypts a message, and delivers a push notification saying 'You have a new task'.
Prompt 2
Generate the VAPID keys needed for the webpush gem and show me how to configure them in a Ruby on Rails initializer.
Prompt 3
Write the JavaScript service worker code and subscription flow that pairs with the webpush gem so a user can opt in to browser notifications and receive a test push.
Prompt 4
Show me a complete example of sending a back-in-stock push notification with the webpush gem, including how to pass the VAPID credentials and the message payload.
Prompt 5
Explain how to migrate from using a GCM API key to VAPID keys with the webpush gem so my push notifications work across Chrome, Firefox, and Edge.

Frequently asked questions

What is webpush?

A Ruby gem that sends push notifications from a Ruby backend straight to a user's web browser, handling the encryption and delivery so your app can reach users even when they are not on your site.

What language is webpush written in?

Mainly Ruby. The stack also includes Ruby, JavaScript, Service Workers.

Is webpush actively maintained?

Stale — no commits in 1-2 years (last push 2025-01-13).

What license does webpush use?

The explanation does not mention a license, so the terms of use are unclear.

How hard is webpush to set up?

Setup difficulty is rated moderate, with roughly 30min to a first successful run.

Who is webpush for?

Mainly developer.

Open on GitHub → Explain another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.