I added ActivityPub support to my static Hugo blog hosted on Vercel. It now automatically announces new posts to followers on the Fediverse. Key challenges included implementing the ActivityPub protocol for a static site, handling WebFinger discovery, managing Follow/Unfollow requests, and sending signed HTTP requests. I used Vercel Serverless Functions for dynamic request handling and Firebase Firestore for storing follower data. Check out the code and follow me @paul@paul.kinlan.me to see it in action!
Friendly Project Name Generator with Zeit
I created a micro-service for generating friendly project names using Zeit's serverless functions and a dictionary of safe words. It's deployed and available at https://friendly-project-name.kinlan.now.sh/. You can use the API endpoint (/api/names) to get random names, specify the number of names with the 'count' parameter, and even customize the separator character. The project is inspired by Glitch's project naming and aims to simplify project creation on Zeit.
Creating a commit with multiple files to Github with JS on the web
I've created a simple UI for my static site and podcast creator that allows me to quickly post new content. It uses Firebase Auth, EditorJS, Octokat.js, and Zeit's Github integration. This post focuses on committing multiple files to Github using Octokat.js. The process involves getting a reference to the repo and the tip of the master branch, creating blobs for each file, creating a new tree with these blobs, and creating a commit that points to the new tree. The code handles authentication, creates blobs for images, audio (if applicable), and markdown content, and then creates the tree and commit. This setup allows me to have a serverless static CMS.
Experimenting with Cloud Functions for use in Web Push
This blog post describes an experiment using Google Cloud Functions to handle web push notifications for services that don't natively support them. I needed a way to process incoming webhooks from various sources like Travis CI and GitHub, transform their payloads into a consistent format for web push, and ensure the system could scale and remain isolated. Google Cloud Functions provided a serverless solution, allowing me to create separate functions for each webhook source. The front-end receives the webhook, pushes the data to a designated Pub/Sub queue, and the corresponding cloud function processes the message and publishes the transformed data to another queue for sending the web push notification. This setup allows for flexibility, scalability, and isolation, fulfilling all my initial requirements.
Running Chrome on AppEngine
It's possible in 3 simple steps
Designing a Web Push Service
This post details the creation of a generic web-push webhook endpoint. Motivated by the desire for a streamlined notification system for various web services, I built a system that allows me to receive push notifications without needing each service to individually support web push. The system consists of a front-end client, a service worker, a front-end server, a subscription service, and a send service. The front-end client manages subscriptions and provides a unique URL endpoint. The service worker displays notifications. The front-end server handles subscription data and message routing. The subscription service persists subscription information. The send service encrypts and delivers messages to the push service. While I anticipate needing to retire this as more services natively support web push, I hope this example serves as inspiration for others looking to implement similar functionality.
Serverless Data Sync in Web Apps with Bit Torrent
This post explores using WebTorrent for serverless data synchronization in web apps, demonstrated by modifying the Voice Memos PWA. The goal was to enable data sharing between devices without a backend server. The solution involves generating magnet URLs that allow peer-to-peer data transfer via WebTorrent. The demo app allows recording audio, saving it locally, and generating a shareable magnet link for access on other devices. This approach offers an interesting alternative to traditional client-server models, especially for scenarios where scalability and serverless operation are desired.