NEW Introducing Heap for Ecommerce.

Codelessly combine attribution, user behavior, and data from your Shopify Store. Learn more.

Heap Blog


How We Write Front-end Code

Writing front-end code in a sufficiently complex web app has never been an easy task. With all the view, state management, and routing libraries out there, it can be hard to know how to fit the pieces together to ensure your codebase is testable and extensible. Through writing many thousands of lines of code for […]

Enabling New Projects At The Recurse Center

We’re big fans of the Recurse Center. RC runs retreats for programmers, in which engineers spend six to twelve weeks working on self-directed projects. It attracts an eclectic crew of smart, curious people. As such, it’s an excellent organization for us to partner with. We started working with RC in 2015, and since then Recursers […]

How To Structure Permissions In A SaaS App

So you’re building a SaaS product and you want to serve real customers and start making those fat enterprise bucks. Great! Now you need to support weird stuff you’ve never heard of before like LDAP, SAML, SSO, and… RBAC. What is RBAC? Role Based Access Control is a system for organizing permissions and specifying who […]

Decrypting PgBouncer’s Diagnostic Information

If you use Postgres at scale, at some point you’ll need a connection pooler. Postgres lets you configure a maximum number of concurrent queries via max_connections, but if you need to handle bursts of more than a few dozen connections at a time, you probably don’t want to provision a lot of connection slots to […]

Analyzing Millions of Postgres Query Plans

Making Heap fast is a unique and particularly difficult adventure in performance engineering. Our customers run hundreds of thousands of queries per week and each one is unique. What’s more, our product is designed for rich, ad hoc analyses, so the resulting SQL is unboundedly complex. For some background, Heap is a tool for analyzing […]

Migrating To React + MobX While Shipping New Features

A year ago our front-end was written in a cumbersome combination of Backbone, TypeScript, and a custom state management layer. It was maintainable, but we wanted to ship features faster than it would let us. We wanted to migrate to a React + MobX architecture, but we couldn’t afford to spend six months rewriting most […]

Terraform Gotchas And How We Work Around Them

Heap’s infrastructure runs on AWS, and we manage it using Terraform. This post is a collection of tips and gotchas we’ve picked up along the way. Terraform and infrastructure as code Terraform is a tool from Hashicorp to help manage infrastructure declaratively. Instead of manually creating instances, networks, and so on in your cloud provider’s […]

How Basic Performance Analysis Saved Us Millions

This is the story of how I applied basic performance analysis techniques to find a small change that resulted in a 10x improvement in CPU use for our Postgres cluster and will save Heap millions of dollars over the next year. Indexing Data for Customer Analytics Heap is a customer analytics tool that automatically captures […]

Redshift Pitfalls And How To Avoid Them

Amazon Redshift is a data warehouse that’s orders of magnitudes cheaper than traditional alternatives. Many companies use it, because it’s made data warehousing viable for smaller companies with a limited budget. Since so many Heap customers use Redshift, we built Heap SQL to allow them to sync their Heap datasets to their own Redshift clusters. […]

When To Avoid JSONB In A PostgreSQL Schema

PostgreSQL introduced the JSONB type in 9.4 with considerable celebration. (Well, about as much as you can expect for a new data type in an RDBMS.) It’s a wonderful feature: a format that lets you store blobs in the lingua franca of modern web services, without requiring re-parsing whenever you want to access a field, […]

Goodbye CoffeeScript, Hello TypeScript

Web apps are becoming increasingly feature-rich, and the Heap frontend is no different. We expose an interface that lets users organize their data and build custom visualizations. Nearly every interaction changes an underlying model and there are subtle rules around how the UI behaves. Our previous stack of Backbone and CoffeeScript wasn’t scaling well to […]