It might seem a little daunting to invest in companies that haven't generated a consistent profit and trade at high valuations. But fast-growing companies are sometimes unprofitable in the early years because they are investing heavily to expand their operations to meet demand.

Companies with huge addressable markets are usually undervalued by investors -- that's why growth stocks, as a group, tend to outperform. Growth stocks can be volatile in the short term, but the long-term payoff could multiply your initial investment.

With that in mind, let me tell you why Okta (NASDAQ:OKTA) and Wayfair (NYSE:W) are two growth stocks worth buying today.

A man's hand holding a white arrow above a stack of coins, each of which has a small house sitting on it.

IMAGE SOURCE: GETTY IMAGES.

A fast-growing business service

Since its IPO in 2017, shares of Okta have been on a tear -- up 348%. The company makes it easy for organizations of all sizes to connect employees with applications through the Okta Identity Cloud platform. With its range of solutions and services, Okta is making IT integration and identity management easier and more secure for corporations of all sizes.

Identity management is a large and expanding market as companies embrace the cloud and look for simpler ways to manage online connections with employees. Okta is the leader in this increasingly important market, serving more than 6,100 clients in nearly every industry. The company's reputation is winning new customers and deepening relationships with existing ones. Revenue has exploded from just $38 million in 2015 to $487 million on a trailing-12-month basis.

Management continues to prioritize long-term growth over short-term profit, which will make the share price volatile. The company's net loss swelled to $155 million over the last year, but Okta is still a relatively small business and is just getting started on winning contracts with some of the largest companies in the world.

The company reported that the size of its top 25 contracts booked in the second quarter was double the size of a year ago. As the company scales its technology to meet the needs of these high-value clients, profits should follow. The recent quarter shows that trend playing out, with the net loss margin narrowing to 7% from 20% a year ago. Okta is on the road to being a much larger and profitable business in 10 years. The stock has taken a breather in the last three months, down 19%, so this is a good time to consider jumping on board.

Home goods spending is shifting online

Wayfair has experienced tremendous momentum in recent years, with year-over-year revenue growth typically hovering around 40% or better every quarter. But the stock has been very volatile, which can be blamed on the company's lack of profitability and high valuation. Still, the company's total market capitalization of $12.4 billion looks quite small relative to Wayfair's $600 billion addressable market.

The online home goods seller is investing aggressively to build out its distribution centers to support growth, which has weighed on profitability. The stock dropped after the second-quarter earnings report, in which management issued a softer-than-expected outlook for revenue growth for the third quarter. Management is now calling for revenue growth to decelerate to the mid-30s range, which some investors took as a sign that the company is losing momentum, but I don't believe that's the case.

Wayfair continues to take market share from brick-and-mortar spending in the highly fragmented home goods market. Plus, people seem to like shopping at Wayfair, as noted by the increase in orders per customer and repeat customers.

Like Okta, Wayfair stock has fallen in the last three months, down 24%. I own shares and still believe this is a growth stock worth holding.

How to think about investing in unprofitable companies

No matter how fast a company is growing the top line, it can be difficult for some investors to buy shares in a business that doesn't generate a profit. What I like about Okta and Wayfair is that each company has a history of growing within its means. Okta generated $5.8 million of free cash flow over the last year, which has been steadily improving as the company grows.

Wayfair is currently going through a heavy spending cycle, which has led to a cash burn of $340 million over the last year. But keep in mind that the founders got started as early as 2002. In the early years, the various niche websites that would eventually become Wayfair were cash flow positive.

Okta and Wayfair are laying the foundation now to beat competitors to the punch. The potential reward could be huge, which is why I would be happy to buy either of these stocks today.