The Greenlight Bookstore in Fort Greene is planning to open a second location in Prospect-Lefferts Gardens. View Full Caption DNAinfo/Rachel Holliday Smith

Two decades after it started selling books online at discounted prices and putting physical retailers out of business, Amazon took a page out of their competitors' book, opening its first-ever brick-and-mortar retail store in Seattle, WA last week.

But despite the gloomy story we've all heard about the slow demise of independent bookstores in the face of rising rents, booksellers in New York City say they're still thriving, amid a forecast for their business that's looking sunnier than ever.

"If they want to compete with the smart, personalized service that indie bookstores and our amazing employees can provide, good luck to them!" said Christine Onorati, the owner of WORD bookstores in Greenpoint and Jersey City, in an email. "I'm up for the challenge."

The number of independent bookstores in the U.S. has grown by 27 percent since 2009, according to data from the American Booksellers Association. In New York City, stores like Book Culture and WORD have opened second and third locations, and others, like McNally Jackson and Greenlight Bookstore, have plans to do the same.

Here are five reasons why New York City booksellers are doing better than you think:

► They're facing less and less competition from national big-box bookstores, like Borders and Barnes & Noble.

Borders, a 40-year-old chain with 200 stores across the country, announced it was closing its three New York City outlets when it filed for bankruptcy in 2011. In recent years, Barnes & Noble has shuttered stores at Lincoln Center and Astor Place in Manhattan after failing to come to agreements with the property owners, and stores in Forest Hills and Bayside will follow suit by the end of this year.

”With Borders gone, Barnes & Noble failing, it’s viable for more and more bookstores to be opening, because people are still reading," said Chris Doeblin, who owns three Book Culture stores on the Upper West Side. "It’s still a vibrant part of people’s lives and I think there’s an under availablity of books in lots of places, certainly in New York City."

► They're testing out new markets with pop-up shops and off-site operations.

Independent booksellers like Strand Books and Greenlight Bookstore have been shrewd about appraising new markets and spreading awareness of their stores with pop-up shops.

Based in Greenwich Village, Strand Books set up a table stocked with its wares at WantedDesign in Industry City three weeks ago. The bookstore is also manning a stand in the Union Square Holiday Market for the first time ever this year, marketing director Whitney Hu said, with the intention of catching all the gift shoppers who haven't discovered their location two blocks south.

Greenlight Bookstore cautiously advanced into the Prospect-Lefferts Gardens with pop up shops at local street fairs and at a neighborhood toy store. Last week, they announced plans to open a brick-and-mortar location in the neighborhood soon.

► They appeal to New Yorkers who increasingly want to shop local.

”There’s definitely been a trend back towards shopping small," Greenlight Bookstore co-owner Rebecca Fitting said. "That kind of thing cycles around over the years: you expand big and then people miss shopping local."

Book buyers have different priorities than they did during the financial recession, Hu said.

"I think buying trends are different: it’s no longer 'Where can I save a penny?' It’s more like ‘Where is my penny maximized the best?'" she said.

And Doeblin thinks consumers are tired of the homogenized selections that big retailers offer.

"People want ... something with more guts to it, a little more earth on it," he said. "They want an ugly apple that tastes delicious. They want a tomato that’s funny looking but really tastes good. We’re sick and tired of this f--king pre-packaged thing that doesn’t have any flavor."

► They select books based both on data and intuition.

Independent bookstores know which books sell well and which ones they have to ship back to publishers, and they send their sales histories to IndieBound, an online community that posts bestseller lists based on that data.

But their buyers are also making predictions about what customers might like, reading book reviews and taking readers' suggestions.

”It’s a combination of forecasting taste and reacting to demand," Fitting said of her store's purchasing strategy.

"You get to know your neighborhood and you get to know your market, and you make your best educated guesses ... as to what books they might want to see or discover in your store. A lot of times we’re right — and sometimes we’re wrong.”

► They're selling items and promoting perks other than books.

McNally Jackson sells espresso drinks and quiche, Book Culture sells graphic T-shirts and Hershel bookbags, and Strand Books has those omnipresent totes. And of course independent bookstores in New York City are known for their readings and community events, bringing readers together in a way that the act of posting an Amazon review never can.

"I know that so many of our customers live a good part of their lives online that they appreciate having a physical place that they can come and be with other people with similar interests," Onorati wrote in her email. "Bookstores provide that welcoming place for readers."