Connected-TV platform company Roku (ROKU -0.82%) went public on Sept. 28, 2017, and the initial public offering (IPO) priced at $14 per share. However, most investors couldn't get that price. Roku stock opened its first day of trading at $15.78 and closed out the day at $23.50 per share.

Supposing you invested $10,000 in Roku stock on day two, you could have purchased 425 shares. Considering it trades at about $61 per share as of this writing, that investment would be worth around $26,000 today. And for what it's worth, that beats the market over this time period.

ROKU Chart

Data by YCharts.

Understanding why someone would have invested in Roku stock in 2017 can help uncover key things to look for in market-beating investments. And looking at why Roku has beaten the market can help reveal whether Roku stock can continue to outperform going forward.

Was Roku worth a $10,000 investment in 2017?

In Roku's filing to go public, it said, "We currently generate a majority of our revenue from sales of our streaming players." And this is easily seen in its financial results at the time. Sales of Roku's hardware devices accounted for 84%, 74%, and 56% of revenue in 2015, 2016, and 2017, respectively.

Selling hardware was never the end game for Roku. It went on to say in its initial filing, "Our business model is to grow gross profit by increasing the number of active accounts and growing average revenue per user, or ARPU, which we believe represents the inherent value of our business model."

Hardware sales are the gateway to acquiring Roku users. Those users stream video content, purchasing subscriptions and viewing ads, which generate revenue for the company. This platform revenue has a higher profit margin than its hardware.

For perspective, Roku's gross margin on hardware in 2017, the year it went public, was just 10%. By comparison, its platform revenue had nearly a 76% gross margin.

This was ultimately the investment thesis for Roku in 2017. The company was adding accounts quickly, causing high-margin platform revenue to skyrocket. Platform revenue jumped 110% and 115% year over year in 2016 and 2017, respectively. If you bought Roku's IPO, you were counting on continued growth in this important area, and ultimately, you were rewarded.

In 2017, Roku generated platform revenue of $225 million. Just five years later, the company generated platform revenue of $670 million in the third quarter of 2022 alone.

Was Roku stock worth a $10,000 investment? That depends on the size of the diversified portfolio. The outcome of the past five years was far from certain. But investors with foresight could see that low-margin hardware revenue was quickly being surpassed by high-margin platform revenue, meaning the company would look much better in the future. Therefore, I'd say Roku deserved a small position back at the time of its debut.

Is Roku worth a $10,000 investment today?

Again, the size of an appropriate Roku investment depends on the size of someone's portfolio, but I'd still put Roku stock in a smaller category reserved for more speculative stocks right now. Here's why.

The good thing is that Roku continues to add new accounts at an impressive pace. At the end of the third quarter of 2017, it had 16.7 million active accounts. By the end of the same quarter last year, it had 65.4 million. And last month, it announced that it surpassed 70 million accounts around the new year -- the most new accounts it's added during a quarter in two years.

However, other dynamics of the investment thesis for Roku have changed. For example, the company now sells hardware products for a loss whereas it used to make at least a slim gross profit. In the third quarter, gross margin for hardware was negative 17.5%. 

Moreover, stock-based compensation has surged higher over the last five years for Roku, outpacing growth for both revenue and gross profit, as the chart below shows.

ROKU Stock Based Compensation (TTM) Chart

Data by YCharts.

The rapid rise of stock-based compensation dilutes shareholder value -- with more shares, the value of each share goes down. And it's a trend that could continue, considering the company expects over $1 billion in stock-based compensation to be recognized over the next three years.

Moreover, Roku is launching more hardware devices to build out its smart-home platform, which could result in further losses.

That said, Roku can overcome these headwinds if it can grow active accounts and increase monetization going forward. And considering the company has done this consistently since the IPO, it's reasonable to assume it can continue to do so.

Ultimately, this is why I believe Roku stock is still worth owning as a long-term investment, even though the company is facing challenges.