A new facility dedicated to serving the needs of homeless and at-risk families opened Thursday in San Francisco.

The 18,000-square-foot Compass Family Services hub, located on Grove Street near City Hall, will offer medical, housing and other services. The facility aims to serve more than 5,000 parents and children living in poverty in San Francisco. The climate of skyrocketing rents is making things tough not just for at-risk families, but also for the nonprofits that serve them.

Compass board chairman Chris Wagner says it was a coup for his organization to be able to purchase the new $8.5 million building.

"We can't survive if we don't have the ability to secure our real estate and the site to serve people," Wagner said in a phone interview. "There's an irony to finding a permanent home for a nonprofit to serve people who are homeless."

Compass was able to purchase the building with help from a real estate investor, a $1 million grant from the city's Nonprofit Sustainability Initiative and other sources.