<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Fred Wulff on Medium]]></title>
        <description><![CDATA[Stories by Fred Wulff on Medium]]></description>
        <link>https://medium.com/@frew?source=rss-c30001442d6------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*aGdJ38jcJr_ojYZT.jpg</url>
            <title>Stories by Fred Wulff on Medium</title>
            <link>https://medium.com/@frew?source=rss-c30001442d6------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 08:32:56 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@frew/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Maybe nobody screwed up in Iowa?]]></title>
            <link>https://medium.com/@frew/maybe-nobody-screwed-up-in-iowa-82bb130bed32?source=rss-c30001442d6------2</link>
            <guid isPermaLink="false">https://medium.com/p/82bb130bed32</guid>
            <dc:creator><![CDATA[Fred Wulff]]></dc:creator>
            <pubDate>Tue, 04 Feb 2020 23:58:33 GMT</pubDate>
            <atom:updated>2020-02-05T00:20:26.534Z</atom:updated>
            <content:encoded><![CDATA[<p>So, that app in Iowa.</p><p>A lot of people seem focused on questions around “how could somebody be this technically incompetent?” or “why don’t these people understand security?”</p><p>But what if instead of a single devious political official or an incompetent engineer, everybody was just doing their best in a twisty maze of misaligned incentives?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*W8hYpQ_7SiMEdZ8fjgGe1Q.jpeg" /></figure><p>Politics has some qualities that make it uniquely unsuited for traditional technical development. It has a boom-and-bust cycle around elections. For events unique to presidential politics, like caucuses, this means that they only happen every four years.</p><p>If you go to a VC for your tech startup and say, “Hey, I want to start something with a Total Addressable Market of a million dollars, where I can only make sales every four years,” you’d get laughed out of the room.</p><p>So that’s why you don’t see many successful silicon valley-style startups with traditional goals that are focused on political campaigns. And all the people who are in politics have different incentives from traditional startups.</p><p>First, there are some people who are in careers that involve being in politics for a long time. If you’re a presidential-level campaign manager you spend your election years playing in the big leagues. You spend your off years at a think tank, working for the government, unions or NGOs, or managing a comic book shop.</p><p>In particular, if what you want to do is be a campaign manager, unlike in software, there’s no alternative market for “be a campaign manager, but be hired full-time, get RSUs and free lunch and $500k/year”. The top of your career is doing it for a major presidential campaign.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/250/1*8xx-A1SLq1s1BHAo70o6uQ.jpeg" /><figcaption>Canonically, 4 years prior to this photo, Josh was assistant copy-editor for Arby’s</figcaption></figure><p>There are also careers that involve being at one politics-related entity for a long time. There are lots of consultancies for things like advertising or analytics that serve both campaign and non-campaign clients. But folks at those places necessarily need to balance their once-four-yearly political clients with the ongoing health of their consultancy.</p><p>There are also jobs at state or national parties. These parties are almost universally resource-starved, especially outside of elections, so the long-term staff tend to be focused on keeping the lights on and they see their primary professional goal as benefitting the state or national party long-term. They generally don’t have a lot of technical expertise. During an election cycle, there are a lot of well-meaning volunteers, but wrangling them is a skill all of its own.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/295/1*SdGKo5kCdbLENPMwLZnyRg.png" /></figure><p>I don’t know exactly what happened with the Iowa caucus app, so I’m going to gamely make some guesses, focusing on how the underlying incentives contribute to the outcome, without anybody involved necessarily being incompetent or doing anything other than participating in a Wire-style organizational Greek tragedy.</p><p>My hypothetical starts with the Iowa state party folks. The Iowa caucus is by orders of magnitude the most important event in their professional lives. They get more voter interest and donations than any other time of the year, and their organization temporarily swells by an order of magnitude.</p><p>But there’s a problem. Every year, staffers on the campaigns are unhappy with how long it takes to report results. Being able to announce a win in prime time is potentially the difference between everybody on the campaign being an early member of a winning campaign and being an also-ran. This year, the next day is the State of the Union, also known as where democratic press releases go to die.</p><p>So campaign staff go hard pushing on the party, telling them they need to get the results out by prime-time. Or the biggest event of their year is going to be a black eye. The campaign managers aren’t really building a long-term relationship with the party since they need a strong showing this year more than they need the party to be happy with them. And the party doesn’t want to piss them off, because in aggregate one of them has a fair chance at being close to the next President of the United States. So the good of the state party necessitates not having the next President of the United States thinking the Iowa State Party is a bunch of clowns.</p><p>This all happens a few months before the caucus.</p><p>Collecting results from the Iowa caucus requires getting data from 1,681 precincts and change. From the perspective of the party, they know how long it takes to collect by phone and how much of a pain it’ll be to do with the staff available. And it’s a manual process and if they get it wrong, then suddenly the caucus becomes a complete mess and everybody’s mad at them.</p><p>They hear that campaigns previously have used apps to collect caucus results in real-time, so that seems like a reasonable next step. They put out feelers and a couple of consultancies seem interested.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/220/1*wiguB0q88x2oD2iDcgmVaQ.png" /></figure><p>Now we get to Shadow. They hear that the Iowa state party is interested in an app for the caucus. They also know that campaigns in the past have successfully collected caucus results in real-time in previous years, so it seems doable. It’s less than 2k reports, after all. The timeline is short but not unbelievable if they cut scope aggressively. Also, caucuses are completely in the open, and there’s the backup of just calling in results — even if results are delayed, the worst case doesn’t seem that bad. And if they don’t do it, someone else will.</p><p>On the plus side, being the consultancy that did Iowa Caucus app is worth some serious cred, both for political campaigns and for work for NGOs, etc. This seems doable and reasonably scoped. They hash out a contract and start moving forward.</p><p>So Shadow starts the work, cutting scope aggressively. They make a simple mobile app because with the number of reporters, they can just use TestFlight and avoid both the app store delay and dealing with mobile web jank. They add a PIN system for auth.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/1*gliiAjcyZHEUXBDxQgLLUQ.png" /></figure><p>At some point the state party talks to election security experts. They’re adamant that making an app to collect data opens the party up to risks. They can’t all be mitigated, but they’re clear that there are a few steps that can help protect the results: don’t let attackers know about the app beforehand, make sure to use 2fa, and make sure that there’s a flow for spot checking results. Since the party at this point has committed to having the results earlier in the night, and the results being called into question is apocalyptic, they decide to move forward with that plan and tell Shadow about the requirement for 2fa and for spot checking results.</p><p>They get to the point where Shadow wants to start testing the app, but there’s the worry about the app leaking out. Together they decide that since 2k users isn’t that much load, they agree to a plan where a couple of volunteers, who are active in the state party, test the reporting flow. They also do a little synthetic loadtesting. They fix some UX issues, and note that the 2fa flow is challenging but seemingly necessary.</p><p>Maybe Shadow pushed back on some of the requirements, but the Iowa party had talked to multiple security people who said they needed secrecy and 2fa. Maybe they figured that the worst case was falling back to phones and security worries were more important.</p><p>Now we get to the caucus, and the shit hits the fan.</p><p>Maybe the volunteers they tested with were more tech savvy than the 75th percentile precinct captain.</p><p>Maybe something was different between the load test instance and the production instance that caused problems.</p><p>Maybe the 2fa solution didn’t work with bad connectivity and hadn’t been part of the load test.</p><p>Maybe the flow mostly worked, but a few people mixed up the back button and the next button and when they did data spot checks, the data didn’t match what people thought they entered, and they couldn’t guarantee the data without calling everybody.</p><p>Everybody had agreed that there would be a telephone fallback, but the party was planning for a few people with minor problems, while Shadow expected the fallback to be able to take the full load.</p><p>Chaos ensued.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*4D1xm69s1IEadvX4j4Emxw.png" /></figure><p>If this were a real postmortem with real data, there’d be lots of areas for improvement:</p><p>The party could have decided that fast results weren’t worth the risk of an app. But they would have had to piss off the campaigns and there was evidence from previous campaigns that collecting the data wasn’t that risky.</p><p>Shadow could have pushed back on the requirements or scope. But they either would have had to do it at the start, when it seemed doable, or after they had committed, at which point they’re the consultancy that “couldn’t deliver the Iowa caucus app that only had to handle 2k reports”.</p><p>Shadow could have tried harder to make sure the telephone fallback had appropriate capacity. But the party had just made a huge bet on them, and there’s a big difference between “hey, just in case make sure you have a phone number available” and “hey, this thing we’re about to deliver has a real chance of not working at all”, particularly when talking to a non-technical customer.</p><p>And again, it’s not like the validity of the final results were in question, since, again, the caucus results are public at each precinct.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/1*zXJmKVv9jms5mGS54Ujiow.jpeg" /><figcaption>“I got my app, you got your specs.” (loosely paraphrased)</figcaption></figure><p>So everybody did what they did, and everything’s on fire, and maybe we should talk about how to fix the incentives rather than looking for somebody to burn at the stake. Happy 2020.</p><p>(I want to reiterate that this is all hypothetical. I don’t know what actually happened or who said what. This is just falls roughly along the lines of other political tech endeavors I’ve seen play out with bad outcomes.)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=82bb130bed32" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[We’re proud to announce that Streak has been named Google’s G Suite Technology Partner of the Year!]]></title>
            <link>https://medium.com/streak-developer-blog/were-proud-to-announce-that-streak-has-been-named-google-s-g-suite-technology-partner-of-the-year-c1733bee5e6e?source=rss-c30001442d6------2</link>
            <guid isPermaLink="false">https://medium.com/p/c1733bee5e6e</guid>
            <category><![CDATA[google-cloud-platform]]></category>
            <category><![CDATA[g-suite]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <dc:creator><![CDATA[Fred Wulff]]></dc:creator>
            <pubDate>Wed, 10 Apr 2019 22:52:43 GMT</pubDate>
            <atom:updated>2019-04-10T22:52:43.777Z</atom:updated>
            <content:encoded><![CDATA[<p>In addition to being an endorsement of our product’s innovation and utilization of Google’s services, this award is a testament to the excellent work our team has been doing to push G Suite and the Google Cloud Platform further and faster for the last several years.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/512/1*NIxVhax9bW5Fs5hOv3ZXiA.png" /></figure><p>Building Streak has always presented us with unique, hard-to-solve, engineering challenges. These kinds of challenges are why we keep building: doing the hard work today — whether that’s beta-testing the latest Google API or finding novel ways to use existing ones — sets us up for success tomorrow. We believe in sharing our solutions to these challenges, too, because we know it improves both our product and the developer community more broadly.</p><p>Just over the last year, our developers made sure <a href="https://www.inboxsdk.com/"><strong>InboxSDK</strong></a> and the millions of users that rely on it were ready for the massive changes to interface and functionality of the <a href="https://support.google.com/a/answer/7684334?hl=en">new material Gmail</a>.</p><p>We also developed <a href="https://github.com/StreakYC/Ratchet"><strong>Ratchet</strong></a>, the first Java data-modeling library for Cloud Spanner to interface with our database — the largest of its kind in Spanner. Streak uses it to decrease the time required to create Spanner-powered features and to ensure that everybody on the team is working with a consistent view of the data model. We’re excited to share it with the open source community and look forward to helping enlarge the Spanner ecosystem.</p><p>Our roadmap for the next year is full of equally challenging problems. We’re investing heavily in optimizing our Google Cloud infrastructure, building a graph database on top of Cloud Spanner and Cloud Bigtable, and applying machine learning on top of our massive dataset.</p><p>If you’re interested in working with our international team on those problems, check out our <a href="http://www.streak.com/careers">careers page</a> — we’d love to solve them with you!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c1733bee5e6e" width="1" height="1" alt=""><hr><p><a href="https://medium.com/streak-developer-blog/were-proud-to-announce-that-streak-has-been-named-google-s-g-suite-technology-partner-of-the-year-c1733bee5e6e">We’re proud to announce that Streak has been named Google’s G Suite Technology Partner of the Year!</a> was originally published in <a href="https://medium.com/streak-developer-blog">Streak Engineering Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Robinhood Crypto Con]]></title>
            <link>https://medium.com/@frew/the-robinhood-crypto-con-7fed0edc0d7e?source=rss-c30001442d6------2</link>
            <guid isPermaLink="false">https://medium.com/p/7fed0edc0d7e</guid>
            <category><![CDATA[cryptocurrency]]></category>
            <category><![CDATA[tech]]></category>
            <category><![CDATA[finance]]></category>
            <dc:creator><![CDATA[Fred Wulff]]></dc:creator>
            <pubDate>Thu, 31 Jan 2019 17:07:45 GMT</pubDate>
            <atom:updated>2019-01-31T17:27:54.510Z</atom:updated>
            <content:encoded><![CDATA[<p>Robinhood Crypto is hiding fees in unexpected places, while promising that they aren’t in their documentation</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/250/0*GTS_kb6PnQz02CZh" /></figure><p><em>(Disclaimer: I am not lawyer and this is not legal advice. I have about $61 in a Robinhood account, currently sitting as cash. I have no significant investment interest for or against Robinhood.)</em></p><p>There have been a lot of articles examining how devious (or not) Robinhood is being in their quest to make a profit while not charging their users commission. Most of the discussion has hinged on whether it’s ethical for the company to share its customers’ stock order flow by high frequency traders in exchange for payment.</p><p>But there’s been relatively little examination of their Crypto product and whether they monetize it. Spoiler: they do, and they’re fairly duplicitous about it. If you read the <a href="https://techcrunch.com/2018/01/25/free-cryptocurrency-trading-app/">TechCrunch launch article</a> for Robinhood Crypto, you’d come away believing that the product is fee-free compared to existing player Coinbase and that they’re taking a hit by forgoing any fees to attract new users to their platform.</p><p>However this isn’t, strictly speaking, true. The product does have a direct end-user payment when you trade, and the assurances that Robinhood are making in their accompanying material hinge on an exceptionally obtuse definition of the term “commission fee”.</p><h3>The Spread</h3><p>The key is that Robinhood, without making it explicit anywhere in the product or help center material, is treating crypto as a foreign-exchange market. And in the context of a foreign exchange market, there are two ways that the broker makes money directly from their customer: fixed commission fees or what’s called a spread.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/0*Zz_NuXwG9u4-luSw" /><figcaption>The concept of manspreading, while also troubling, is not covered here</figcaption></figure><p>If you parse Robinhood’s <a href="https://support.robinhood.com/hc/en-us/articles/360001227666-Why-is-the-price-displayed-on-the-Crypto-Detail-pages-different-from-the-final-buy-and-sell-price-on-the-order-page-">support articles</a> the way they’re obviously hoping the SEC would, they only promise that they’re not going to charge an explicit commission fee. But if your previous experience is from trading on the stock market, as most of Robinhood’s customers likely are, this spread fee is going to be surprising.</p><p>At its most basic, there are two prices for a security (e.g. a stock, option, or currency): the bid price, which is what somebody’s willing to buy it for, and the ask price, which is what somebody’s willing to sell it for. In a market, the ask price is typically higher than the bid price, because otherwise, the seller with the lowest ask price should go ahead and sell their security to the bidder with the highest bid price. The difference between the two prices is the spread.</p><p>For a security with an active market, the spread should be relatively low, since there should be many sellers and many buyers, and there’s no particular reason the sellers should have a vastly different opinion of the value of the security than the buyers. And that’s what the screenshot below, taken from Coinbase Pro’s BTC-USD market, shows. There’s 1.0025 BTC worth of offers to sell at 3432.02 BTC/USD and 0.6848 offers to buy at 3432.01 BTC/USD, yielding a one cent spread. There are also many more offers to buy or sell further away from the mid-market price.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*sfhe0GfK0_jpeg0l" /></figure><p>So that’s a spread.</p><h3>What’s A Spread Fee?</h3><p>What’s a spread fee and why is it surprising for traders coming from the U.S. stock market?</p><p>A spread fee is when a broker quotes their customer a bid price that’s lower than the underlying market or an ask price that’s higher than the underlying market. You’re probably used to seeing it look like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/0*V3R-jPEost5XmyrH" /></figure><p>In the case of a currency exchange booth in a foreign country, the 0% commission means that the trader is making their profit by lowering the buy price and inflating the sell price. But Robinhood is going a step further than even a tourist-fleecing exchange booth, and is displaying a single price, like a stock. And so traders coming from the U.S. stock market have no idea there is a fee hidden in the spread since SEC rules prohibit that.</p><h3>Why Aren’t Spread Fees More Popular?</h3><p>The rules from the SEC are generally referred to as Regulation NMS, which establishes a set of bid and ask prices for nationally traded stocks known as the National Best Bid and Offer and forces brokers to offer their customers prices that are at least as good as the NBBO. Despite the fact that there are a lot of exchanges that your broker can execute your trade on, brokers can’t charge you more than the NBBO ask price for buying stock or less than NBBO bid price for selling stock.</p><p>At the end of the day it means that if the NBBO ask price for a stock is $9.90, your broker can’t say “best I can do for you is $10” and then pocket the extra ten cents they’d make by buying at $9.90 and selling to you at $10. That’s making money on the spread and it’s not allowed by Regulation NMS.</p><p>But Bitcoin isn’t part of the national market system covered by Regulation NMS, so making money on the spread is allowed. And it turns out Robinhood is doing exactly that.</p><h3>Robinhood Crypto’s Hidden Fees</h3><p>If you look at <a href="https://pro.coinbase.com/trade">Coinbase Pro</a> or <a href="https://gemini.com/">Gemini Exchange</a>, both of which are licensed to do business in much of the U.S., a typical Bitcoin/U.S. dollar bid-ask spread is around $0.01. The Robinhood UI doesn’t call out the spread, but in their UI the quoted price (on the left in the screenshot) is the mid-market price, and the “Estimated Price” (on the right) is the ask price since we’re buying BTC.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Fu1kFzqjELGY7YgA" /><figcaption>See if you can spot the spread fee</figcaption></figure><p>If we compute ($3451.16-$3444.27)/$3444.27 we get 0.2%, and in fact, every time I’ve run this calculation there’s a flat 0.2% difference between the mid-market price and the ask/bid prices. I verified that this difference is real by placing a buy limit order at the midpoint between the mid-market price and the ask price and verifying that it didn’t execute.</p><p>The level of the fee itself isn’t that outrageous — it’s similar to Coinbase Pro’s “taker” fee of 0.2% for small accounts, although I’m guessing that Robinhood is in one of the higher transaction volume brackets that corresponds to lower fees and Robinhood doesn’t pass along the savings of the 0% “maker” fee on limit orders that don’t execute immediately.</p><p>But Robinhood goes to significant lengths to hide this fee. The effort starts with their UI. While I included a screenshot of their website to show the two prices, most of their users interact with the platform on mobile. There, the estimated bid/ask prices are on entirely different screen then the mid-market price, making it extremely hard to compare the two or even notice that they’re different.</p><p>Besides the Techcrunch interview, their own support articles strongly suggest that the fees are just a result of market movement. The <a href="https://support.robinhood.com/hc/en-us/articles/360001298246-Cryptocurrency-Investing">article</a> linked when you click on “Estimated Price” answers the question “Why is the estimated buy price different than the estimated sell price?” with an explanation of market liquidity, but no mention of Robinhood’s own role in setting the spread.</p><p>Similarly, another <a href="https://support.robinhood.com/hc/en-us/articles/360001227666-Why-is-the-price-displayed-on-the-Crypto-Detail-pages-different-from-the-final-buy-and-sell-price-on-the-order-page-">article</a> answers the question “Why is the price displayed on the Crypto Detail pages different from the final buy and sell price on the order page?” with “Robinhood doesn’t charge commission fees. Any price difference you may see between the estimated buy/sell price and the execution price is due to market movement.” In this they’re clearly hoping that unsavvy customers won’t realize that:</p><ol><li>Robinhood isn’t actually treating Bitcoin like a US stock, despite the familiar language about market fluctuations that resembles a typical stock broker disclosure.</li><li>They’ve mentioned no “commission fees” but failed to mention the cost built into the spread at all.</li><li>The original question asks about the difference between the detail price and final order price, but the answer only refers to the difference between the estimated price and the final order price. The detail price from the original question is a mid-market price. Both estimated and final order prices are either ask or bid prices. So the answer to the original question clearly should include the spread fee.</li></ol><p>Other exchanges include their percentage-based fee schedule upfront, but the only mention I could find anywhere of this practice is buried in the <a href="https://d2ue93q3u507c2.cloudfront.net/assets/robinhood/legal/Robinhood%20Crypto%20User%20Agreement.pdf">Crypto User Agreement</a> where section 1(c) gives Robinhood Crypto the ability to pass on fees while retaining rebates. My guess is that behind the scenes, they’ve structured this so that they’re passing on a 0.2% fee on all transactions from whichever crypto markets they’re connecting to, while keeping significant volume-based rebates.</p><h3>In Conclusion</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*uQJcvrMYNe1dvwyu" /></figure><p>(Don’t blink either, or you’ll miss the fees)</p><p>Regardless of how much profit the Crypto product is netting Robinhood, their “Don’t Sleep” marketing campaign around the feature is clearly meant to attract users who are unfamiliar with the fee structures of foreign exchange markets (which also generally have the extended hours Robinhood is touting), and their supporting articles are actively misleading.</p><p>(Photo credits: <a href="https://www.flickr.com/photos/dunnock_d/32302225131/">https://www.flickr.com/photos/dunnock_d/32302225131/</a> and <a href="https://www.flickr.com/photos/wnyc/20549953806/">https://www.flickr.com/photos/wnyc/20549953806/</a> )</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7fed0edc0d7e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Powering Streak’s Gmail Add-on: Part 1 — Backing into GraphQL]]></title>
            <link>https://medium.com/streak-developer-blog/powering-streaks-gmail-add-on-part-1-backing-into-graphql-1546be75c78?source=rss-c30001442d6------2</link>
            <guid isPermaLink="false">https://medium.com/p/1546be75c78</guid>
            <category><![CDATA[g-suite]]></category>
            <category><![CDATA[graphql]]></category>
            <category><![CDATA[google-cloud-platform]]></category>
            <category><![CDATA[gmail]]></category>
            <dc:creator><![CDATA[Fred Wulff]]></dc:creator>
            <pubDate>Wed, 27 Dec 2017 03:16:54 GMT</pubDate>
            <atom:updated>2017-12-27T03:16:54.502Z</atom:updated>
            <content:encoded><![CDATA[<p>At <a href="https://www.streak.com/">Streak</a>, we recently partnered with Google to release our <a href="https://www.blog.google/products/g-suite/do-more-your-inbox-gmail-add-ons/">Gmail Add-on</a> as part of the Add-ons launch. The Add-on is our first major foray into integrating with your existing mobile apps: it lets you better organize your work email in the mobile Gmail app, and makes it easier to collaborate with your team to make sure nothing slips through the cracks. The reception has been great. Our Add-on is top rated in the <a href="https://gsuite.google.com/marketplace/app/streak_crm_addon_for_gmail/800057673271">Marketplace</a> and tens of thousands of users interact with it regularly. But the backend of the Add-on is also new: it’s 100% powered by <a href="http://graphql.org/">GraphQL</a>, albeit in an unusual way, and I wanted to share the engineering story of how we got here.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/343/0*PXAYtcldghrBnjUU." /><figcaption>The Streak Gmail Add-On on Android</figcaption></figure><h3>A Performance Problem</h3><p>Our GraphQL journey started with us staring at a loading spinner. The fundamental purpose of our Gmail Add-on is to give the user more context about their emails. Useful context comes in many forms. If you’ve told Streak that an email is part of a sales deal, then we should add information about that deal when you view the email. If the customer you’re talking to is also talking to somebody else on your support team about an issue, you probably want to know that. And if the customer’s trial is going to run out today and might need to be extended, that’s important, too.</p><p>Surfacing all this context is the core of our user experience, but the information lives in a lot of different places, so displaying it requires querying a bunch of different API endpoints: pipelines, contacts, deals, other emails, and organizations just to start. Our main Javascript client pipelines these queries using parallel, asynchronous requests against our REST API, making sure that we’re pulling contacts at the same time as organizations at the same time as the deal information.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/994/0*-5H7c9VhxDKwQPro." /><figcaption>Some of the many parallel requests fetching one box using the web client</figcaption></figure><p>This was where we hit our first Add-ons roadblock. Google <a href="https://developers.google.com/apps-script/">Apps Script</a>, which powers Add-ons, is a hosted Javascript sandbox environment with some non-standard APIs. Instead of the traditional XHR interface, requests to backends are required to use a custom URLFetch service. And URLFetch only allows blocking requests. Requesting all the data serially could take tens of seconds. <strong>Ain’t nobody got time for that.</strong></p><p>We realized that to get acceptable performance, we needed to combine the requests. Instead of getting “/email/15fb6cb3b627304f” followed by getting “/contacts/15fb6cb3b627304f”, we needed one endpoint: “/emails+contacts/15fb6cb3b627304f”. We spent a while manually bundling handlers together, but it turns out nobody on our team wanted to pick up artisanally hand-crafting batch endpoints as a long-term hobby.</p><p>Griping about it at lunch one day, one of our frontend developers suggested GraphQL. GraphQL bundles a lot of functionality that’s useful for making flexible APIs in a query language and a simple HTTP protocol. And relevant to our interests, GraphQL lets you request multiple objects in one go.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lkFR-Sm1Xsr11Ym__qsJYw.png" /><figcaption>A single GraphQL query fetching multiple objects</figcaption></figure><p>It also provides functionality for introspecting response schemas, only fetching portions of a response (to save bandwidth costs), and for eagerly requesting related objects (e.g. following foreign keys to their object). This is very powerful, but in the context of a user-facing API, also a little scary. Some of our teams have hundreds of thousands of deals. What if somebody requested all of them <em>and</em> their related information in one go?</p><p>So we decided to take a measured approach to GraphQL, using it only for communication between our Add-on running in the Apps Script sandbox and our backend to start.</p><h3>GraphQL Implementation Strategies</h3><p>There are two main models for retrofitting GraphQL onto a RESTful API backend. The first adds a proxy layer in front of the existing server, typically in Node since that runtime has the original GraphQL backend server. The proxy translates the GraphQL query into traditional API requests, sends them in parallel, and constructs the GraphQL response.</p><p>The second model adds a GraphQL endpoint directly on our backend server, using the <a href="https://github.com/graphql-java/graphql-java">graphql-java</a> library. This endpoint either programmatically requests information from the existing endpoints, or does the same work they do to fetch the data from our backend datastore.</p><p>The main arguments in favor of the proxy approach was that it was completely separated from our existing stack. Our existing endpoints were well-tested, we were confident that we knew how to monitor them, and we knew that they correctly enforced permissions.</p><p>The main arguments for the integrated approach center around development and runtime efficiency:</p><ul><li>Thinking about development time, our existing API uses <a href="https://github.com/google/gson">GSON</a> to serialize data model objects into responses. By reusing the annotation and type information from GSON, we don’t have to duplicate our data model schema when creating our GraphQL endpoints.</li><li>Then at runtime, many of our existing API endpoints have to fetch multiple objects in order to provide their results. For instance, when fetching a contact, we also have to fetch the team that contact belongs to in order to make sure the current user has permission to view the contact. If a GraphQL query wants both the contact <strong>and</strong> its team, we shouldn’t need to fetch the team once for the GraphQL query and then again to check permissions for the contact.</li></ul><h3>Initial Results</h3><p>Since our whole purpose of using GraphQL was to make our Add-ons more efficient, we decided to pursue the integrated option. After some fun with Maven and getting Java 8 deployed on App Engine, we got a proof of concept working.</p><p>The good news: requests were batched and the request took about half as long as the previous serial requests.</p><p>The bad news: half as long as the previous serial requests was still roughly six seconds longer than we were looking for.</p><p>Hopeful but with a ways to go, we dove into the exciting world of GraphQL layering and instrumentation to track down the lingering performance issues.</p><p><em>We’ll talk more about our GraphQL experience next week, and in future blog posts delve into the build infrastructure we developed to build the Add-on itself and how we used </em><a href="https://cloud.google.com/spanner/"><em>Google Cloud Spanner</em></a><em> to enhance our backend performance.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1546be75c78" width="1" height="1" alt=""><hr><p><a href="https://medium.com/streak-developer-blog/powering-streaks-gmail-add-on-part-1-backing-into-graphql-1546be75c78">Powering Streak’s Gmail Add-on: Part 1 — Backing into GraphQL</a> was originally published in <a href="https://medium.com/streak-developer-blog">Streak Engineering Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>