Copy, Paste, Profit: Eliminating Development Friction

Early on in my time working with the egghead.io team, I noticed something small that impacted every single person working on the web app locally. It was something that caused enough friction to be a little disruptive, but not enough friction to pull someone off of what they were working on.

The sign in system used magic links. In development, instead of sending an email to the authenticating user like it would do in production, the system would print the magic link to the server logs. To complete the auth flow in development, you'd go find that magic link in the server logs, grab it, and open it in your browser.

I'm sure this was a nice, agreeable solution at one point. However, as the app grew, pages loaded more data, worker processes were added, etc., the server logs got very noisy. In the five seconds between submitting the magic link sign in form and switching back to the terminal to grab the link, the link had scrolled way off the page. Not so fun. You find yourself scrolling back through dozens to maybe even a couple hundred lines of dense server logs hoping your eye catches the line that contains that magic link.

To my fresh eyes: I thought surely there must be a better way. To someone who has been in the system for years: this is just how it is.

When small things get like this in our software systems, it's easy to be resigned to "that's just what we have to do to [sign in as a user in development]". We don't see that there can be a better way or even consider looking into it. If we did consider how it could be better, maybe we stopped ourselves short with a "I don't want to get sidetracked with bikeshedding like this."

And so every time we want to sign in it takes longer than it needs to. It takes everyone longer than it needs to. Some percentage of the time, in the process of context switching from the browser to the terminal, something else catches our eye and we get swept up in that and lose track of what we were trying to do in the first place. This adds up over the days, weeks, and months.

Beyond some contrived tally of minutes per year per developer spent authenticating in development, I believe there is a less tangible, but even more important aspect of how our software systems feel to use. Are they snappy, intuitive, and smooth? Or are they sluggish, confusing, and full of friction?

If a point of friction that impacts every single person on the team can be smoothed out with a small amount of effort, that's a big win in terms of productivity and psychology.

Though this post is more about the concepts I've just laid out, I'll still give you some insight into the solution I came up with.

First, I figured the simplest thing I could do was draw more visual attention to the link, so I added some additional puts statements.

if Rails.env.development?
  puts "*" * 80
  puts "*" * 80
  puts "Magic link: #{@magic_link_url}"
  puts "*" * 80
  puts "*" * 80
end

Once I was in this part of the code, something clicked. What if I don't even have to go digging around in the server logs? The thing we know this developer is trying to do at this exact moment is sign in. Let's give them what they need when they submit the sign in form. Let's put the magic link right on their system clipboard.

if Rails.env.development?
  puts "*" * 80
  puts "*" * 80

  puts "Magic link: #{@magic_link_url}"

  # Check if pbcopy exists and copy to clipboard if it does
  if system("which pbcopy > /dev/null 2>&1")
    system("echo '#{@magic_link_url}' | pbcopy") && puts "✨ Magic link copied to clipboard! ✨"
  else
    puts "⚠️ pbcopy not available, magic link not copied to clipboard ⚠️"
  end

  puts "*" * 80
  puts "*" * 80
end

Now when submitting the sign in form, there is no need to switch to the terminal at all. We can immediately replace what is in the URL bar with our clipboard contents, hit enter, and we're signed in. Frictionless.

This was magical for the development team. I remember a couple people expressing relief at not having to track down that magic link anymore. And now it is such a seamless part of the system that many have probably forgotten how it used to be.

This was quick to implement and good enough. With everyone on a Mac, it was fine to lean on pbcopy. If I needed it to be cross-platform, I'd consider reaching for something like the clipboard gem.

The takeaway is to try to remain curious about what parts of our system are creating drag and what kinds of quick wins are possible. A sluggish, high-friction system is one that we avoid using because it slows us down and zaps our energy. A snappy and smooth system can be enjoyable and enable us to do better work.

Tell us about your project

We build good software through good partnerships. Reach out and we can discuss your business, your goals, and how VisualMode can help.