Growth stocks have taken a beating over the past 18 months or so. In many cases, valuations were just too high. The days of investors paying many dozens of times sales for profitless software companies appear to be over, at least for now.

While some beaten-down growth stocks still look too expensive, others now look like solid deals. Shares of PubMatic (PUBM 0.33%) and DigitalOcean (DOCN -1.52%) have been hammered, down at least 75% each. Both companies have great long-term growth prospects, and the valuations are now attractive enough for investors to jump on board.

PubMatic

Sell-side digital advertising platform PubMatic is holding up reasonably well in a tough market for digital ads. The company managed to grow revenue by about 2% year over year in the first quarter, driven in part by faster-growing segments like omnichannel video. The company's second-quarter guidance wasn't too bad, either. PubMatic expects to produce revenue between $58 million and $61 million, down slightly from $63 million in the prior-year period.

PubMatic owns and operates its own cloud infrastructure. This shunning of public clouds gives the company a key cost advantage, but downturns can be painful. As utilization of its servers drops, PubMatic's gross margin can take a big hit. That's exactly what happened in Q1. The cost of revenue grew much faster than revenue itself, and PubMatic reported a net loss of $5.9 million.

Net income is an accounting number, though, and doesn't reflect the actual cash flowing into the business. Running its own infrastructure gives PubMatic the ability to cut back on capital spending to let demand catch up with capacity. The company expects to spend 60% less on capital expenditures (capex) in 2023 compared to 2022. Despite the tough environment, PubMatic expects its free cash flow to remain roughly unchanged for the full year.

Shares of PubMatic are down about 78% from their all-time high. The company is valued at about $770 million, and it produced free cash flow of roughly $38 million in 2022. That puts the price-to-free-cash-flow ratio at 20.

Given PubMatic's long-term growth prospects, that valuation looks reasonable. Global spending on omnichannel video ads is expected to reach $215 billion this year, representing a huge long-term growth opportunity. Once this storm passes, PubMatic should have little problem returning to growth. While PubMatic's financial results won't look pretty for the time being, it's a great ad-tech stock for long-term investors.

DigitalOcean

After years of breakneck growth, the cloud-computing industry is slowing down. Big companies and organizations are looking for ways to cut costs in a tough economy. Given that as much as one-third of cloud spending is wasted, according to a survey by Flexera, there's plenty of room for cloud customers to chip away at their bills.

While the big cloud platforms like Amazon Web Services (AWS) are focused on enterprise customers, DigitalOcean is focused on the little guy. Developers and small businesses, each spending on average less than $90 per month, comprise the bulk of the company's customer base. Just over half of DigitalOcean's revenue does come from its "big" customers -- those who spend at least $500 per month. That's still peanuts compared to the largest customers on AWS.

DigitalOcean is facing a slowdown of its own as customers pull back, but revenue is still expected to grow by 23% this year. That's a solid result given the economic environment. And thanks to DigitalOcean's strategy of spending little on sales and marketing by relying on word-of-mouth and a huge collection of content to draw in potential customers, the company will become substantially more profitable this year. Free cash flow is expected to nearly double compared to 2022.

The company is making a big bet on managed services as it doubles down on its core mission to make cloud computing simple. The acquisition of Cloudways last year brought a leading managed cloud provider under DigitaOcean's umbrella.

Unlike a standard cloud server, where customers must handle just about everything on their own, a managed cloud server usually includes robust support, migration services, application installation, real-time monitoring, automated backups, and a variety of other features. The upside for DigitalOcean is that a managed cloud server is priced much higher than an unmanaged one.

Shares of DigitalOcean are down just about 75% from their all-time high. Growth isn't going to be as impressive this year, but the developer-focused cloud platform is turning into a cash-flow machine as it scales. DigitalOcean's revenue growth rate should recover once industry growth picks back up, and with the stock trading around 19 times free-cash-flow guidance, it's hard to argue that the stock is too expensive given its long-term growth prospects.