Nutrepedia: Multilingual Nutrition Reference Tool Built with Clojure and HTMX

Nutrepedia is a multilingual nutrition reference site designed to provide fast, effortless access to food nutrition data across 29 regional locales. Built by developer Jovan (llovan), the platform aims to be a free, reference-first layer of nutrition information that avoids the typical "calorie-first" or "signup-first" barriers found in many nutrition tools.

Technical Stack and Architecture

Nutrepedia is built using a modern functional programming stack focused on efficiency and simplicity. The core technology choices include:

  • Backend: Clojure, HTTP-Kit, Compojure, and Hiccup.
  • Frontend: HTMX for dynamic updates without full page reloads.
  • Database: Postgres, which serves as multiple roles including food data storage, localized content management, admin workflows, task queues, and search.

Multilingual Search Implementation

To handle search across diverse scripts and languages, Nutrepedia employs a specific database-level search strategy:

  • Latin-script fuzzy search: Utilizes pg_trgm and unaccent in Postgres to handle variations in spelling and accents.
  • CJK and non-Latin scripts: Implements PGroonga to support efficient searching in Chinese, Japanese, and Korean languages.
  • Romanized Aliases: The system indexes romanized aliases separately, allowing users to search for a term like "rasbhari" to find the Hindi name "रसभरी".

Content Scale and Localization

The platform currently hosts 1,635 foods, which are rendered into 47,415 localized pages. Each page provides localized names, portion terms, nutrition facts, and imagery.

Community Feedback and Technical Critiques

Following its showcase on Hacker News, the community provided several technical and conceptual critiques regarding the localization and data accuracy:

User Experience and Accessibility

Users reported several UI/UX issues, including:

  • Input Behavior: Some users on mobile devices (Firefox and other browsers) reported that the keyboard closes automatically or the input box behaves erratically when entering serving sizes.
  • Navigation: A critique was noted that search results are not hyperlinks, preventing users from middle-clicking to open results in new tabs.
  • Accessibility: Suggestions were made to use Chrome's Lighthouse tool to improve image alt text and color contrast, specifically noting that the search bar's pink background and yellow text are difficult to read.

Data Accuracy and Regional Standards

Several users highlighted the gap between US-centric data (USDA) and international nutritional standards:

  • Carbohydrate Calculation: Critics pointed out that the US method of labeling total carbohydrates (requiring users to manually subtract fiber) differs from EU and UK standards, where fiber is listed separately.
  • Unit Localization: Users noted that translating the word "cup" into other languages does not necessarily translate the actual measurement (e.g., 236ml), as regional "cups" vary significantly.
  • Regional Food Differences: Feedback suggested that the USDA database may not be applicable to processed foods or specific varieties of food produced in the UK or EU, where formulations differ from US versions.

Feature Requests

Users suggested several enhancements to improve the utility of the tool:

  • Default Units: A request for the ability to set a default unit of measurement, such as 100g, for easier comparison.
  • Dietary Diversity Analysis: A suggestion to allow users to compare a food item's nutrition relative to a reference weekly diet to see how much diversity it adds to their overall nutrition.

Sources