Marijuana legalization is sweeping the nation, and The Green Rush is upon us. As pot sellers scramble to comply with complex regulations, one startup has built the full-stack of specialized commerce software they need. Meadow offers everything from an eye-catching digital storefront for teasing tasty plants, to automated patient records management for which you’ll go to jail if you screw up.

That’s why Meadow is emerging as the Amazon of weed. But it’s not just the website where you go to buy the best buds from a variety of top local shops. It’s the AWS powering the back end of the THC trade.

Meadow already provides:

Online and mobile ordering

Delivery logistics

In-store point of sale

Inventory management

Returns and discounts

Patient intake and registration

Analytics

Security

Today Meadow launches that final piece of its marijuana dispensary software suite: loyalty. It lets ganja buyers earn points for shopping at the same place, which they can redeem for cash back, discounts, free products and prizes. Customers can earn and apply points in-store or online, and track how many they’ve racked up at all of Meadow’s vendors. It could be especially helpful for sellers who want to get rid of pot before it goes stale or another shipment comes in, without screwing with their public pricing.

“The ability to accrue points gives the dispensary a tool to build a deeper relationship with the customer,” says Meadow co-founder David Hua. “We’ve seen a lot of dispensaries fail at managing a loyalty program. Creating one is easy, tracking it with inventory and your reporting often can be super onerous for the operator.”

Hua is a stoner, no doubt. But Meadow’s CEO is also a shrewd businessman who won it TechCrunch’s 2015 Crunchies award for best bootstrapped startup, led it through Y Combinator and raised its $2.1 million seed round last year. Operating out of a warehouse in San Francisco’s Mission District, pungent smoke often wafts in from the courtyard of Meadow HQ. Its willingness to serve as a community hub and event space has established Meadow as the commerce layer connecting players in the burgeoning legal pot business.

Meadow frequently gets compared to fellow weed software startup Eaze . While both run a virtual doctor’s office where you can get prescribed marijuana over video chat, and both offer an aggregated online storefront and delivery logistics service, that’s where the similarities end.

Eaze has aggressively raised more than $24 million for marketing in a bid to become the Uber for weed, organizing deliveries without formally employing the couriers. But Hua sees that as a more generic piece of the marijuana commerce puzzle that could get commoditized. It’s the hardcore back-end office software for navigating heavy regulation that’s harder to copy, but critical for running an upstanding pot business.

Meadow’s vision is that if a dispensary relies on it for everything from scanning bar codes on jars of weed in their store to securely storing patient medical data, they’ll tack on its online storefront and delivery logistics for convenience sake.

That plot is panning out. Despite having raised just $2.1 million in April 2016, Hua says “We still have plenty of runway. We’re good on funding.” In fact, now that the 10-person startup can serve 70 percent of California counties that allow medical marijuana, Hua tells me Meadow is “getting close to profitability.”

The pot market is poised to get much more exciting as marijuana becomes legal for all adults in California at the start of 2018. “Looking at Colorado, Washington, Nevada [where weed recently became recreationally legal], those markets tripled, quadrupled, 5Xed over night. We expect to have a nice multiplier.” While only focused on California for now, Meadow has enormous growth potential as more states decriminalize.

Legalization brings challenges too, though, as regulations change, competition increases and more established businesses try to muscle in on the weed trade. That’s why Hua has raced to bring in best practices from outside of the pot world, watching how Square, Belly, FiveStars and other commerce platforms handle point-of-sale and loyalty.

With the end of any prohibition comes massive opportunities for new ventures. Some jumped into holding and selling weed themselves. Others like Eaze have vied to handle how it gets to your door. But Meadow has taken the unsexy path of building serious commerce software. As weed finally becomes a serious business in 2018, all that time coding could blossom into a very sticky service.