Buying a home these days is a high-stakes, need-to-have/nice-to-have equation. You need a home within an hour's drive of work; it would be nice to have one that's in walkable distance. You need a full-size kitchen with room for your five-person brood; it would be nice to have a chef's kitchen with La Cornue Grand Palais range, Meneghini Arredamenti fridge, and, heck, a Mugnaini wood-fired pizza oven. You need at least 2.5 bathrooms; it would be nice to have a master en suite spa with a touchscreen-controlled smart bidet.

Dream the dream, my friends.

So what's the neediest of all need-to-haves? You need to find a safe place to live where you can still afford a great home. And wouldn't it be nice if there were even fun stuff to do after work and on weekends? Yes, indeed.

Realtor.com set out to find these seductive strongholds where you can have it all. And we're not talking about the boonies: We zeroed in on metropolitan areas, which include cities and the surrounding suburbs. (Note: Cities often have higher crime rates than their less-populated surroundings.)

Research — and common sense — indicates that when crime goes up, property values go down. Meanwhile, home buyers will pay more to live in locations with lower rates of violent crime, according to a 2015 Auburn University study. It doesn't hurt that these areas typically also have top public schools.

More From Realtor.com

"When homeowners think about the biggest investment of their life, top of mind is how safe an area would be to live in and raise a family," says Rick Palacios Jr., director of research at John Burns Real Estate Consulting.

They also want to make sure that their investment appreciates over time, which it typically won't do as much in areas with growing crime. "High crime rates unnerve potential home buyers," he says. Um, yeah.

The good news: Crime has declined sharply since the early '90s. Violent offenses, which include homicide, assault, and robbery, plummeted 49 percent from 1993 to 2017, according to FBI data. This explains why some of our safest places were once known for riots and rampant car thefts before they rebounded. (The downside: Gentrification is leading to some longtime residents being priced out.)

The places that made our affordable safe harbor ranking are a mix of smaller metros that never really struggled with high crime, and cities once riddled with problems that have successfully pulled off a turnaround. Our list is concentrated on resurgent Midwest, Southern, and Rust Belt cities. No Western metros were included because home prices are simply too high.

We analyzed crime data provided by NeighborhoodScout, a website that tracks community data, focusing on America's 150 largest metros. We eliminated those with high rates of violent or property crime, and with home prices above the (roughly) $300,000 national median. Next, we zeroed in on cities with great extracurriculars — running the gamut from nightlife, to kayaking, to great indie bookstores — as tracked on Yelp.com.**

Safety, affordability, and fun. Yep, they can coexist. Let's take a tour.

1. Grand Rapids, Mich.

Median home list rice: $280,000
Total crime rate: 18.38 percent

As some Michigan cities, including Flint and Detroit, continue to face hard times, Grand Rapids is booming. The very low 2.5 percent metro unemployment rate is reason No. 1 for the upswing.

"The economy is strong here, with lots of jobs at different levels," says Trisha Cornelius, a local real estate agent with Keller Williams. “The neighborhoods are affordable and clean. There isn't much in the way of urban blight."

Indeed, only 2.2 percent of homes here are vacant, compared with 9.6 percent in Flint and 6.5 percent in Detroit, according to the U.S. Census Bureau.

Meanwhile, the metro has been attracting younger residents lured by those plentiful gigs, the affordable housing, and the influx of craft breweries in the area.

"A 25-year-old can actually afford to buy a home here," Cornelius says. They're snagging luxury, one-bedroom condos priced at around $200,000 such as those in a converted, historic school building spanning two city blocks.

But bargain prices won't last forever. While the national housing market is starting to slow, Realtor.com projects Grand Rapids will be the second-hottest market in 2019, with a 8.2 percent projected sales price growth.

Local R&R: Buckle your blades on for ice-skating in Rosa Parks Circle.

2. Pittsburgh, Penn.

Median home list price: $173,000
Total crime rate: 18.44 percent

As Pittsburgh's steel mills shuttered and residents pulled up stakes, many neighborhoods fell into a crime-ridden, downward spiral. But that feels like ancient history these days, as the city continues to reinvent itself as a thriving corporate center for startups and tech biggies like Uber and Google alike. Now those once-hurting neighborhoods, like Brighton Heights, are seeing their fortunes rise and rise, with an influx of new workers moving in.

Brighton Heights "is a neighborhood in transition… When I was growing up in the '90s, it was certainly not a place for a first-time home buyer; but that's changed,” says local restate agent Bobby West of Coldwell Banker.

Young professionals and home flippers are buying up many of the community's Craftsman-style homes built in the early 1900s for under $150,000.

The number of violent crimes plummeted 24.8 percent from 2000 to 2014, according to the most recent FBI data. While crime is low in the metro, there are still some problem areas within the city limits. And residents are still hurting from last October's tragic shooting at a Pittsburgh synagogue, a hate crime that left 11 dead.

Local R&R: Fixate on flora fantasies at the Phipps Conservatory and Botanical Gardens.

3. Port St. Lucie, Fla.

Median home list price: $285,100
Total crime rate: 19.16 percent

About two hours north of Miami, Port St. Lucie is a quiet Atlantic beach town, long a magnet for retirees.

"Here, it’s just a really calm mix of people, mostly families and retirees," says Richard L. McKinney, a real estate agent at Atlantic Shores Realty Expertise. "People are just coming here to live and commute to work, so we don’t get all that ruckus that comes with tourism" in other Florida ocean areas, he says.

This beach town is made up of lots of new single-home and condo communities. And prices are still reasonable, leading Realtor.com to name Port St. Lucie one of the most affordable beach towns in June. Buyers can find condos just minutes from the beach for $150,000, says McKinney.

Local R&R: Gaze or gape at gators at the Savannas Preserve State Park.

4. El Paso, Texas

Median home list price: $175,800
Total crime rate: 20.48 percent

A combination of tougher police action and changing demographics has led to a substantial decline in violent crime in this once-dicey metro on the U.S.-Mexico border. In the early '90s, El Paso often had more than 50 homicides a year. But from 2012 to 2016, the city averaged fewer than 18 homicides, according to the city's police department. That's good news for locals, and for long-term property values.

Finding a single-story, brick ranch under $200,000 in El Paso is a breeze. In fact, last year Realtor.com named El Paso one of the best markets for middle-class home buyers. Developer-friendly zoning laws and low land costs make building homes here cheaper than in other parts of the country.

Local R&R: Manage your mountain mania! Start climbing at Franklin Mountains State Park.

5. Syracuse, N.Y.

Median home list price: $160,000
Total crime rate: 21.4 percent

In the early 2000s, former industrial center Syracuse began pumping millions into renovating crime-ridden communities near downtown to entice college students to live there after graduation, instead of scramming as soon as possible. Crime dropped so much that everyone from young professionals to empty nesters bought up remodeled condos there.

"Over a decade, downtown Syracuse went from being unsafe to the hottest spot to live" in the area, says Amber Spain-Mosher, a real estate agent at Re/Max in Syracuse. “The residential growth downtown is unlike anything we’ve seen before. And it shows no sign of slowing down.”

Homes in nearby urban neighborhoods have also received a boost. As the city became safer, more people swooped in and bought up fixer-uppers just above the $100,000 price range. That's played a role in home prices rising 9.6 percent over the past year.

Local R&R: The 13-day Great New York State Fair attracts nearly a million visitors annually.

For five more affordable, fun cities, continue reading the original article at Realtor.com.

* A metropolitan statistical area is a designation that includes the urban core of a city and the surrounding smaller towns and cities. We limited our rankings to just one metro per state to ensure some geographic diversity.

** We used Yelp.com for the number of per capita nightlife venues, highly rated restaurants, kayaking/rafting/scuba diving opportunities, gyms, libraries, bookstores, and campgrounds.

Allison Underhill contributed to this report.