A Phabricator bot for Slack
Phabulous is a chat bot for Slack and IRC that lets you receive feed notifications and perform actions on Phabricator from a chat channel.
Initially implemented as a small NodeJS daemon with support for Slack, the project was later re-written in Go, adding support for Slack’s Real-Time Messaging API and a multi-connector architecture allowing for support of other chat services (like IRC).
Minimalistic static-site server
Espresso is a static website server with a minimalistic feature set focused on running in a containerized environment.
While many web servers focus on serving sites from a local filesystem, I built Espresso with the goal of making it easier to deploy static websites within a containerized environment, which may not always have persistent storage available (or even be a desirable feature in some cases).
On startup, Espresso fetches a bundle of the latest version of the site from an S3-compatible bucket and begins serving it. Espresso continues to monitor the bucket for changes to the bundle, re-deploying the site if a new version becomes available. This allows Espresso to be scaled to multiple instances in a container cluster without having to worry about persistent storage needs, providing better availability and redundancy.
Espresso was originally built using Haskell and the Warp server library, however, it later underwent a re-write in Rust as I ventured to learn the language.
The Rust implementation has the following features:
- Declarative server configuration via TOML files and environment variables.
- Multi-threaded design using Tokio.
- Downloads site bundle from S3-compatible buckets or can serve a local directory.
- Health check endpoint support.
- Built-in fallback error pages and directory listings.
- Kubernetes Helm chart.
- CLI utility for uploading site bundles to S3 buckets.
A rate-limitter in Go.
A Go library that can be used to add rate-limitting to services.
It uses Redis as its backing store to keep track of requests per client and properly apply limits through a cluster of servers. While it includes a default set of timing configurations for per-second, minute and hour limits, it also supports specifying custom timing through functions.
Additionally, a middleware component for the popular Go framework, Gin is included, making it easier to add rate limits to APIs and web applications written in Go and running behind a load balancer (such as Amazon’s ELB).
A Go client for Phabricator's Conduit API.
Gonduit is an API client that supports a subset of Phabricator’s Conduit API.
I initially created this library as part of implementing another project, Phabulous. As the project matured, I extracted the client into a standalone library that can be embedded into other Go projects.
Now in use at Uber.
A Git changelog generator.
Shift is a CLI application that generates
CHANGELOG.md files by parsing Git
I created this tool to remove the need to manually generate changelog files on my personal projects, but also as an opportunity to learn more about the data structures that power Git.
To offer the best experience, Shift requires each project to follow the Conventional Commits spec in commit messages. Shift parses commit messages and generates an internal representation of changes between releases/tags.
I chose Haskell to write this project due to its powerful declarative parsing libraries, which made parsing commit messages a much simpler task.
Additionally, for projects hosted on GitHub, Shift can invoke the GitHub API to generate richer changelogs by embedding links to commit diffs and author profiles.
A micro-library for racing HTTP GET requests.
Craze is my first open-source Haskell package. Craze is a small
module for performing multiple similar HTTP GET requests in parallel. This is
achieved through a function called
raceGet, which will initiate all the
requests and pick the first successful response that passes a customizable
check (i.e. Runs a race of requests).
If you have a scenario where you are dealing with data source or API that is very unreliable (high latency, random failures) and there are no limitations or penalties on performing significantly more requests, then racing requests (through direct connections, proxies, VPNs) may be a viable option for increasing the chances of getting a successful response faster and more reliably.
However, it is important to note that this is a brute-force approach and may be potentially inefficient, if using a different data source or transport is a possibility, those should be considered first.
Utilities for serving static sites and blogs with Wai/Warp.
Warp is a performant web server for Haskell applications that follow the WAI interface. Kawaii is a library that encapsulates a lot of the boilerplate involved in setting up a Warp/WAI server for hosting static websites.
The library was originally part of the source code for the server hosting my personal blog, but it was refactored to be more generic and work with more projects.
- WAI applications: Static Website, Home Redirector.
- Built-in HTTP and HTTPS servers.
- A CLI for launching a basic server on any directory.
- A collection of useful middlewares for static websites.
- Collection of middlewares for static sites (Logger, Force SSL, Domain redirect, Security headers, HSTS, CSP, Redirect index.html, etc).