INSPIRATION

A Personal Nightmare Turned into Action My inspiration comes directly from surviving mattress fiberglass contamination myself. It was a devastating event that caused me significant health issues and financial ruin. After losing my belongings and my peace of mind, I realized I wasn't alone—but there were almost no resources to help victims like me.

The Need for Answers I co-founded the Mattress Fiberglass Support & Awareness Group to help others navigate this nightmare. Watching our community grow to thousands of members, I see the same panic every day: parents terrified because they found "glitter" in their child's room but don't know if it's dangerous. I built this project to give those families the immediate, reliable resources, information, and guides that I wish I had when my crisis began.

What it does Mattress Fiberglass Safeguard is a comprehensive Progressive Web App (PWA) designed to be the first line of defense for affected households. It features:

  • AI Visualizer: Users can upload photos of suspicious particles. We use Gemini’s multimodal capabilities to analyze light refraction patterns and identify potential fiberglass shards.

  • Dynamic Cleanup Guide: A smart, step-by-step remediation tool that adapts its protocols based on the severity of the contamination. It tracks user progress and provides verbatim safety instructions to prevent cross-contamination. First, users answer questions to help them determine the level of potential contamination. Then, it provides a personalized walk through of the next steps.

  • Live Expert Audio Agent: A real-time, voice-interactive assistant that helps users navigate crisis. It is just like speaking over the phone to a live Expert. His name is Matt Russ Fybers and he is very understanding, caring, knowledgeable, and ready to help. Matt really has all the answers and always puts safety first.

  • Mattress Checker: A search tool backed by a database of known "safe" and "unsafe" brands to help users make informed purchasing decisions and discover if their brand has ever been reported to have used fiberglass.

How we built it

We built the application using React and TypeScript for type safety, with Vite as our build tool for rapid development. The project used Google AI Studio, Gemini, and Google's Jules to create, manage, edit, and test. The project is stored on a Github repository.

AI Integration: We utilized the updated @google/genai SDK (v1.40.0) to interface with Gemini models for both vision analysis and conversational logic.

Audio Performance: For the "Live Expert" feature, we moved audio processing (volume calculation and PCM conversion) off the main thread. We implemented a custom AudioWorklet to handle the heavy lifting, ensuring the UI remains buttery smooth even during active conversation.

Testing & Reliability:We integrated Vitest and React Testing Library for unit testing our search logic, and added Playwright scripts for end-to-end frontend verification to prevent regression.

Deployment: The app is deployed on Vercel, with a custom CI/CD pipeline that runs our verification scripts on every push.

Challenges we ran into Audio Latency & UI "Jank": Initially, running audio analysis on the main thread caused the interface to freeze during processing. We solved this by migrating to a dedicated AudioWorkletNode, which reduced main thread processing time by approximately 28.6%, completely eliminating the glitches.

Vite & Vercel Configuration: We faced a critical "Blank Page" issue on deployment due to module loading conflicts and incorrect path resolutions in vite.config.ts. We had to restructure the entire project (moving files from a nested directory to the root) and switch to process.cwd() for proper ESM compatibility.

API Key Handling: We encountered runtime crashes when the Gemini API key was undefined during component mounting. We fixed this by moving the GoogleGenAI instantiation inside the component logic with robust error guards.

Accomplishments that we're proud of

Technical Optimization: Successfully implementing the AudioWorklet was a huge win. It transformed the "Live Expert" from a laggy proof-of-concept into a responsive, production-grade feature.

Adaptive UX: We are proud of the Dynamic Cleanup Guide. Instead of a static text block, it now saves the user's progress locally and adjusts the severity of the instructions (e.g., adding critical DIY disclaimers) based on the assessment results.

Turning Pain into Power: Most importantly, taking a traumatic personal experience and turning it into a functional tool that can help families navigate through crisis or just giving them the help and answers they need, is our biggest accomplishment.

What we learned

Browser Audio Architecture: We learned that for high-performance audio apps, the main thread is off-limits. Understanding the AudioWorklet lifecycle was a steep learning curve but essential.

The Importance of "Verbatim" Protocol: Through user feedback, we learned that in safety-critical situations, users don't want summaries—they want specific, verbatim instructions. We refactored our data model to ensure the AI delivers exact safety protocols without hallucinating steps.

Robust Testing: After facing regression bugs, we learned the value of setting up a proper testing harness (Vitest + Playwright) early in the project.

What's next for Mattress Fiberglass Safeguard

Community Nexus: We plan to build out the currently placeholder "Community Forum" to directly connect app users with our 1200+ member Facebook support group.

Expanded Hubs: We aim to expand the Education Hub to help users understand upcoming laws, like the California fiberglass ban taking effect in 2027. Also, we plan to implement a community forum and blog in the app, connected with our website.

Built With

Share this project:

Updates