Cooking Bot
system-design 6 min read

Safety-First AI for Food Systems

Why we don't trust LLMs with allergies

Safety NLP System Architecture Streaming TypeScript spaCy

Building a Safety-First AI Cooking Assistant

In the world of AI-powered food applications, there’s no room for error when it comes to health and safety. A single mistake in allergen detection could have serious consequences. This is the story of how we built a sophisticated French cooking assistant that processes over 35,000 recipes with an unwavering commitment to safety, performance, and user experience.

When we set out to build our cooking assistant, we weren’t just trying to create another recipe aggregator. We wanted to solve the complex problem of personalized recipe discovery that could safely accommodate every dietary need, preference, and restriction. The challenge was multifaceted:

Our Dataset: The Foundation of Quality

Our system starts with a comprehensive dataset of 35,000+ French recipes sourced from Elle à table, one of France’s most prestigious culinary publications. This isn’t just a collection of ingredients lists – it’s a rich tapestry of:

The diversity and quality of this dataset presented both an opportunity and a challenge. While it provided excellent raw material, the complexity of French culinary language meant that simple keyword matching would never be sufficient.

What We’re Building: The Complete Vision

Our cooking assistant is designed to be a comprehensive culinary companion that can:

1. Intelligent Recipe Discovery

Users can search using natural language, dietary restrictions, available ingredients, or even just a vague craving. The system understands context, intent, and constraints to deliver perfectly matched recipes.

2. Safety-First Personalization

This is where we differ from every other recipe app. Our system doesn’t just filter by tags – it performs deep allergen analysis on every recipe, considering:

3. Adaptive Cooking Guidance

Once a recipe is selected, the system provides real-time cooking assistance through voice interaction, adapting instructions based on:

4. Intelligent Substitution

When ingredients are unavailable or restrictions apply, the system suggests safe alternatives that maintain recipe integrity while respecting all dietary constraints.

The Architecture: A Multi-Layered Approach

To achieve this vision, we designed a sophisticated multi-layered architecture that balances performance, safety, and scalability:

Technology Stack: Modern, Efficient, Purpose-Built

Our technology choices reflect our commitment to performance, developer experience, and operational excellence:

Runtime & Foundation

Backend & API

Frontend & User Experience

AI & NLP Processing

Infrastructure & Deployment

The Safety Philosophy: Deterministic Over Probabilistic

The most critical architectural decision we made was our safety-first approach to AI. While many systems rely entirely on LLMs for understanding and processing, we implemented a hybrid approach that combines:

1. Rule-Based Systems for Critical Functions

Allergen detection, dietary classification, and safety-critical parsing use deterministic rule-based systems. These are:

2. LLMs for Enhancement and Validation

We use LLMs strategically for:

This approach ensures that critical safety functions never fail due to AI hallucinations or model drift, while still leveraging the power of modern AI for user experience.

Performance and Cost Considerations

Building a system that processes 35,000+ recipes and serves real-time user queries requires careful attention to performance and cost:

Processing Pipeline Efficiency

Cost Optimization Strategies

The Development Experience: Docker-Native Workflow

We believe that great systems require great development workflows. Our Docker-native development environment provides:

# Start the entire stack with hot reload
make dev

# Connect to staging databases for real-world testing
make remote-dev

# Run comprehensive test suites
make test-all

This setup gives developers:

100%