In 1979, in a goat shed on a small farm in north Boulder, two physics professors and an engineer started Boulder Beer Company, Colorado’s first craft brewery. Forty years later, that once-goat shed brewhouse sells more than 16,000 barrels annually and distributes its beer in 34 states.

But Thursday, just a few months after celebrating its 40th anniversary, Boulder Beer Company announced it is shrinking operations, laying off 21 employees and ending widespread distribution, which means that its beer will soon be available only at its Boulder brewpub.

Colorado’s oldest craft brewery will still sell its beers in stores across the U.S. through the end of 2019. But starting in the new year, you’ll only be able to find brands such as Mojo IPA and Buffalo Gold at the brewery’s Wilderness Place taproom outside Boulder.

“Boulder Beer has been part of my life for close to 30 years, as it has been for so many of our loyal friends and patrons, and we all want to see it live on,” Gina Day, Boulder Beer’s owner, said in a news release.

With this move, the business will still be able to operate independently “for years to come,” Day said.

Boulder Beer employs 50 people, and 21 will be laid off over the next two months, according to Tess McFadden, the brewery’s marketing director. The brewery is also selling off its canning and bottling lines, along with its larger brewing tanks, and will pare down to a smaller brewing system.

Boulder Beer’s decision comes at a time when craft breweries across the country are steadily selling to larger companies. Another Boulder behemoth, Avery Brewing, this year announced a 70% sale of its business to Founders Brewing Co. and Mahou San Miguel.

Heavy competition has made craft beer a tough market for independent brewers, particularly as sales in the sector slow. While craft beer now makes up about 13% of the overall beer market, its 3.9% growth in 2018 is the sector’s lowest in a decade, according to the Boulder-based Brewers Association, with overall beer sales in the U.S. dropping 1% last year.

“… In an era where the U.S. (and Colorado) have more breweries than ever before, there is somewhat of a contradiction in the overall strength of the craft segment and the health of individual (breweries),” said Bart Watson, chief economist at the Brewers Association. “Although we continue to see demand grow for fuller-flavored beers from small and independent brewers, that growth does not ensure the success of all brewing companies.”

Boulder Beer’s struggles, Watson said, simply reflect the state of the larger industry, where “there is only so much shelf space and a growing number of breweries trying to put their beer on those shelves.”

“It’s no secret that the craft beer industry has become increasingly competitive in recent years,” said Tristan Schmid, marketing and events manager for the Colorado Brewers Guild. “Packaging and distribution come with their fair share of costs, which is one reason we’ve seen so many smaller breweries successfully focus instead on their immediate ‘backyards,’ selling locally brewed beer solely out of their taprooms.”

In 2016, Wynkoop Brewing Company — Colorado’s oldest brewpub, which opened in 1988 — announced plans to stop packaging and distribution of its beers to refocus on the taproom at 1634 18th St. Also that year, Twisted Pine Brewery made a similar decision for its operations in Boulder.

“Times have changed and change is hard, but I’m ready to put the ‘fun’ back in beer,” Day said in the news release. “Our friends will still be able to enjoy our beers in the brewpub, and by brewing in small batches, (we) have a wider variety of options on the ever-rotating specialty taps.”

Just last week, Boulder Beer participated in its 37th Great American Beer Festival in Denver. It’s one of only two independent craft breweries in the country that have poured beer at every GABF; the other is California’s Sierra Nevada Brewing Company.

“We make beers that people like,” Dan Weitz, Boulder Beer’s sales director, told The Denver Post before this year’s festival. “We don’t just check off a box.”

Boulder Beer’s founders — Randolph “Stick” Ware, David Hummer and Alvin Nelson — started the company on a lark, but their beer became serious business.

“I liked making beer, and one day I said, ‘We should start our own brewery,’ ” Ware told The Post before GABF. “Because I shot off my mouth, I had to follow through.”

Boulder Beer has remained a constant as the state’s craft brewing business has ballooned around it, reaching up to 400 breweries.

“The decision for Boulder Beer to cease distribution surely wasn’t a light one,” said Schmid, with the Brewers Guild, “but the ability of ownership and management to make tough choices is likely one reason the brewery is one of the oldest original craft breweries in the country and why it’s been able to adapt and evolve for the past 40 years as the industry has skyrocketed.”

If you go: 2880 Wilderness Place, Boulder, 303-444-8448, 11 a.m.-10 p.m. daily, boulderbeer.com