Transactions in Phoenix

I recently set out to implement user registration for a project I’m working on in Elixir/Phoenix. It wasn’t long before I encountered a challenge that I have stumbled upon with every other ORM library: accepting a collection of form inputs and saving it across multiple (related) records in the database.

There’s more than one way to tackle the problem (with varying degrees of elegance), but I discovered that Ecto lends itself particularly well to solving this problem once you are familiar with tools available.

Continue reading →

Announcing: The Art of Product Podcast

Since August 2016, I’ve had the pleasure of being a regular guest co-host on Giant Robots Smashing into Other Giant Robots along with Ben Orenstein. I’ve been a long-time podcast consumer, but was initially reluctant to try my hand at recording myself. After some healthy prodding from Ben, I agreed to try a few episodes and, lo and behold, we’ve been recording ever since.

A few weeks ago, Ben dropped the news to me that he was moving on from Thoughtbot to start his own business. This left us an interesting new storyline to tell and no podcast on which to tell it!

So in true scrappy bootstrapper form, The Art of Product podcast was born. We plan to release one ~30 minute episode per week and continue with the same format from Giant Robots, discussing whatever interesting things we’ve been up to recently.

Have a listen and leave us a 5-star review in iTunes if you dig it!

Solving Our Slow Query Problem

One of the core features of Drip is the ability to segment your subscriber database by tags, custom fields, events performed, campaign and workflow subscriptions, and so on.

As our Postgres dataset has grown into the multi-terabyte size range, these ad-hoc segmentation queries have become increasingly expensive to run, especially for accounts with many thousands of subscribers and millions of subscriber events.

Continue reading →

When To Build Your Own Billing Engine

Back when we started Drip in 2012, it was customary to write your own recurring billing engine.

Fundamentally, a SaaS billing engine is simply a scheduled task that runs each month for each customer and hits a payment API to charge them. Layered on top that is the concept of pricing tiers, trial periods, failed charge retry, proration, annual plans, and invoice generation.

Most developers these days choose not to build their own billing engine, as free platforms like Stripe subscriptions promise to rid your application code of complex billing logic. It seems like a no-brainer, right?

Continue reading →

Choosing the Perfect Tech Stack

Nothing quite compares to greenfield software development. The canvas is blank and you finally have the opportunity to do it “The Right Way” from the ground up. If you’ve been building web apps for a while, you’ve undoubtedly found yourself working with technologies that you’d never use again, given the luxury of a blank canvas. And if you follow the open source world, there’s probably a brand-spanking-new boutique framework you’ve been itching to take for a spin.

With all the excitement of a blank canvas comes an equal amount of anxiety. You know you are one ill-advised choice away from being stuck with the “imperfect” tech stack. You have a hunch about what you want to use, but being the dutiful engineer that you are, you spend a few hours verifying your assumptions by Googling “Ruby vs Go” and “nodejs vs haskell” only to find yourself with net loss of clarity. (Don’t do that.)

Take a deep breath, it doesn’t have to be this hard.

Continue reading →