Thousands of retail stores are on track to close by the end of the year as consumers embrace online shopping. But one company continues to rapidly expand its physical footprint and rake in profits year over year — Dollar General.

The Goodlettsville, Tennessee-based company announced its third-quarter earnings on Thursday, revealing that it is on track to open 975 stores this year, and 1,000 by the end of 2020 — or 20 stores each week. That's in addition to the more than 16,000 locations it already has, which is more than McDonald’s in the U.S. and more than Walmart globally.

"We have a great group of individuals that work for this company that work hard every day to make sure we execute at a very, very high level. And that's what really gave us the notion to move a little faster here," CEO Todd Vasos told investors Thursday, noting that sales rose 8.9 percent to nearly $7 billion over the last three months, compared to the same time last year.

As retail companies such as Macy's, Gap, and Walgreens slough off expensive store space, Dollar General has only added more locations. The company's rapid expansion is only expected to continue as economic trends squeeze the middle class, and economists warn of a looming recession.

“The economy is continuing to create more of our core customer,” Vasos told the Wall Street Journal in 2017. “We are putting stores today [in areas] that perhaps five years ago were just on the cusp of probably not being our demographic...and it has now turned to being our demographic.”

Dollar General was created out of the recession. Since the company went public in 2009, it has staked its claim in rural America. Most Dollar General stores are located in towns with populations of fewer than 20,000 residents and miles away from grocery stores or big-box retailers. Its core customer brings in less than $40,000 per household. An estimated three-quarters of U.S. residents live within five miles of a Dollar General store. In comparison, just over one-third of people live a five minute drive to a Walmart, according to the company research firm GlobalData Retail.

The stores are strictly "no-frills," stocked with only the most popular consumer brands. The company has also rolled out a line of private label products, which allows it to control manufacturing and price. It is able to offer such cheap prices in part because items are sold in smaller packaging, which means that shoppers may be paying more per ounce compared to full-size products.

Dollar General's competitive edge goes beyond what it stocks on a shelf. The company is also expanding its fleet of carrier trucks from 80 to 200, and plans to bring FedEx drop-off and collections to more than half of its stores by the end of 2020. There is also a Dollar General app, which enables customers to scan their items and check out on their phone, reducing in-store wait time and minimizing the number of workers required. In some stores, customers can also use the app to calculate the cost of their cart before they check out at the register.

These developments have Wall Street analysts and shareholders optimistic about how the company will grow, even — or perhaps especially — in a recession.

“When you have more challenging times, value-oriented retailers generally outperform the rest of retail,” Robert Ohmes, an analyst with Bank of America, told NBC News. “Depending on the type of recession, it does outperform.”

“They understand their store model extremely well,” said Simeon Gutman, an analyst with Morgan Stanley. “They know how much they need to pay in rent, and they know their customer base really well. The risk is clear and simple — overbuilding where you can’t compound that growth the way they have historically. But they’re well aware of that.”

As income disparities widen, more people in the U.S. choose dollar stores over grocers such as Whole Foods for their shopping. Grocery sales at Dollar General and Dollar Tree neared $24 billion in 2018, compared with Whole Foods’ roughly $15 billion, according to market data. To meet that need, Dollar General rolled out fresh food departments and expects 650 stores to offer produce by the end of 2019.

But the company’s dominance in serving low-income people in the grocery market has raised concerns among local officials and nonprofit community advocacy organizations such as the Institute for Local Self Reliance, which argues that local grocers can’t compete with Dollar General as a Wall Street company.

“We're seeing severely diminished small business lending from those same banks and investors,” said Charlie Thaxton, a researcher with the organization. “Access to capital is vital in order for small businesses to get off the ground. This funding drought means that entrepreneurial local grocers who want to provide fresh foods to their community really don't even have a chance to compete.”

Some towns and cities have even adopted bans on stores such as Dollar General, arguing that these businesses create food deserts. Others, such as Kansas City, Oklahoma City, and metro Atlanta, have introduced zoning changes that would limit the number of dollar stores in their towns. New Orleans City Councilwoman Cyndi Nguyen, who represents the district that includes the Ninth Ward, ordered a planning commission study over the summer to investigate the impact of small box retail stores on the local economy. There are a total of 36 small box dollar stores across the city and 12 in east New Orleans, which Nguyen represents.

“We’re literally saturated,” she said. “My community, my district is ready for big development and small box retailers but we want to make our economic area very diverse so it attracts different types of families, because I want to continue to grow families.”

Yet even backlash from local officials has not stopped Dollar General growth nationwide. Same store sales continue to increase every quarter.

“They’re becoming the rural convenience store,” said Gutman.