Inspiration

The 2021 Texas freeze got us thinking about what a power outage looks like inside one home. Imagine your oxygen concentrator switches to backup power and the display says you have 30 minutes left. Somewhere nearby, a driver has a compatible battery. Can they get it to your door and set it up in time?

That question became Before Zero. We started with winter storms, but after talking with State Farm, we broadened the project. A tornado can knock out power on a warm night and leave a family facing the same decision.

What it does

Before Zero helps disaster coordinators decide where to send limited supplies. A household reports how much backup time its equipment shows. The coordinator can compare that window with the time a driver needs to pick up a compatible battery, reach the home, and set it up.

In our tornado scenario, a resident reports 30–60 minutes of backup. The original route would get the battery ready with 17 minutes to spare. A 20-minute detour puts that route three minutes past the earliest reported cutoff. An alternate route still leaves six minutes. That gives the coordinator a concrete reason to change the plan.

How we built it

We used TypeScript, React, SpacetimeDB, and Photon. Photon gave us a way to test check-ins through iMessage on a real phone. In SpacetimeDB, we built private tables for households, drivers, supplies, and assignments. Coordinators subscribe to updates for their incident, and drivers see the jobs assigned to them.

A reservation happens in one database transaction. It assigns the driver, reserves the battery, and records the notifications to send. That keeps two coordinators from promising the same battery to different families.

Challenges we ran into

“Battery at 30%” sounds useful until you ask whose battery it is. It could mean the resident’s phone or the equipment they depend on. We designed around reported equipment runtime and kept uncertainty visible. We also had to account for pickup and setup time. A driver reaching the front door is only part of the trip.

Accomplishments that we're proud of

Our favorite test involved two coordinators, two households, and one battery. Both coordinators tried to reserve it at the same time. One assignment went through, the other coordinator saw a conflict, and only the assigned driver could see the job. We also completed a real Photon iMessage round trip and created a synthetic check-in the team can replay without publishing the tester’s personal details.

What we learned

The most useful number on the screen was the number of minutes to spare. “Driver arrives at 2:24” makes the coordinator do the math. “Battery ready with six minutes to spare” tells them why this route is worth taking. We also learned to track a message, an assignment, and a completed delivery separately. Each one tells a different story about whether a family has actually received help.

What's next for Before Zero

We’re connecting the phone check-in to the full dispatch flow and adding a live conversation between the resident and their assigned driver. A resident should be able to ask, “Can you use the side entrance?” and see the driver’s reply. If a household goes silent, a coordinator should own the follow-up.

For State Farm, we want families to be able to create a preparedness profile before a disaster and choose whether to speak with an agent about coverage afterward. Getting assistance stays independent of that choice.

Built With

  • vite
Share this project:

Updates

Submission history