In a factory in Nevada, a large 3D printer prints the pieces of new prefab tiny homes that can work fully off the grid. When complete, the houses will run on solar power, including heating and cooling. An optional system generates water from moisture in the outdoor air so it isn’t necessary to connect to a city water supply. In the bathroom, the home is among the first in the U.S. to use a new shower that cleans and recycles water.

The house, from a startup called PassivDom, is designed to use as few resources as possible. The company didn’t initially aim to create an off-the-grid home, but realized it was possible as it experimented with materials to improve energy efficiency, landing on a polymer composite. “It was strong and efficient, and it helped us build houses with 20 times less energy consumption than usual buildings,” says Max Gerbut, CEO and founder of the company. “A side effect of this technology was that we’ve discovered that we can generate enough energy using solar panels on the roof to heat the house.” Typically, he says, houses with solar panels can’t cover the energy needed for electric heat, especially in cold climates.

The shower was the next problem to solve, since heating water for showering uses a lot of energy. The home uses a shower from Sweden-based Orbital Systems with technology that recycles water in a closed loop. As someone showers, the water flowing into the drain is monitored with sensors. If the water is deemed worth purifying, it flows through filters that can remove impurities as small as bacteria, and further cleaned with an ultraviolet light before it’s recirculated. The water is continuously heated.

“We save water and energy in real time,” says Orbital Systems CEO and founder Mehrdad Mahdjoubi, who was inspired to design the shower after collaborating on a NASA project to design a habitat for Mars. The system saves as much as 90% of the water used in a typical shower, and 80% of the energy. Unlike many other showerheads designed to save water, it doesn’t have to restrict water pressure. Because it can also carefully maintain a precise water temperature, he says that consumers prefer it to regular showers.

Orbital was interested in working with PassivDom because the company was rethinking the entire house, not just adding a handful of disparate eco-friendly features. Mahdjoubi says that Orbital may eventually expand its technology so that it can be used in a bigger closed-loop system in future houses, potentially sending filtered shower water to the laundry, for example, and laundry water to a toilet so people don’t have to flush with what is essentially drinking water.

The new PassivDom homes that are currently in assembly at the Nevada factory will go to early beta customers in Arizona this year. The final version of the homes will hit the market in 2020.