FayHub

The digital platform of the FAY Program: it connects patients, professionals, suppliers and shops, in Switzerland and Italy.

AI suggests recipes and meal plans; only what the nutritionist approves goes into the patient record.

Client
Avalon Solution, Lugano
My role
Architect and sole author of the main codebase
Duration
Main development 2025–2026, now in pilot
Industry
Nutrition and health, Switzerland and Italy

From medical history to meal plan

  1. Step 1Patient medical history, 319 fields
  2. Step 2, with AIAI suggests a reading of the medical history
  3. Step 3, with AIAI proposes recipes and a multi-day plan
  4. Step 4The nutritionist approves, edits or asks for a new version
  5. Step 5Only approved content goes into the patient record

The context

FayHub, built for Avalon Solution, is the digital platform of the FAY Program (Food About You): a program based in Lugano that helps people eat well and enjoyably, through consultations and tailored programs. The program follows its own method, with a color-based approach that classifies food by life stage, goals and state of health, and it is aimed at individuals, doctors, clinics and the food service industry.

FayHub brings the method into daily work: patients, healthcare professionals, suppliers and shops in one system, with clinical and nutritional programs, subscriptions and invoicing in Switzerland and Italy. With one firm constraint: Italian patients’ clinical data must be kept separate from Swiss data. The project is currently in its pilot phase.

What I did

  • AI at the nutritionist’s service. Recipes and multi-day meal plans generated from a structured knowledge base. The nutritionist approves them, edits them by hand or asks for a new version in plain language. The AI can also read recipes from photos, PDFs and documents, including scanned ones.
  • A patient record shared across specialists. A 319-field medical history with automatically calculated scores, reports with visibility set field by field, messaging between patients and professionals. A new professional can access the data only with the patient’s consent.
  • Clinical data in the right country. Italian patients’ data goes to a database and storage separate from the Swiss ones. If a patient moves country, their data moves automatically in the background.
  • Everything needed to run the practice. Bookings synced with Amelia, professionals’ contracts, subscriptions in Swiss francs and euros through Stripe, Italian e-invoices issued automatically, renewals included.

The results

  • 0pieces of AI content entering the patient record without the nutritionist’s approval
  • 2countries, with Italian patients’ clinical data kept in a database and storage separate from the Swiss ones
  • 20areas in a single platform: patient records, AI, bookings, contracts, subscriptions, invoicing

How I worked

I designed the architecture and wrote the main codebase on my own, along with the integrations and the documentation: technical for developers, operational for the people who use the platform every day. I used AI assistants in a structured way throughout development and analysis.

The method

Have a project with similar needs?

Tell me about your project

Technical details

Key architecture decisions

  • Clinical data separated by jurisdiction without rewriting the application: a bridge on the short-circuit filters of the WordPress Metadata API. The code uses the standard APIs and data reaches the right database transparently.
  • Clinical documents in the right country: S3 bucket chosen by data owner, authorized streaming, AWS Signature V4 implemented without an SDK.
  • Patient moving country: asynchronous, idempotent job; the source is deleted only after a successful copy.
  • Verifiable AI output: human approval enforced by the interface, copy-on-write versioning, responses validated against the internal taxonomy.
  • Recipes from heterogeneous documents: background pipeline with per-file-type extraction, switching from text to vision for PDFs.
  • Hundreds of fields by role and country: declarative schemas as the single source of truth for forms, validation, storage and summaries.
  • Multiple access requirements without locking users out: prioritized checks, grace periods, pages that always stay reachable so users can get compliant.

Integrations

OpenAI (gpt-4o, text and vision), Stripe with per-country credentials, Aruba e-invoicing, Amazon S3, Google Geocoding, Amelia, WooCommerce Subscriptions with both block and classic checkout.

By the numbers

35,511 lines of code in 51 files, 170 commits over 109 days of activity (from version 0.3.6 to 1.4.4), 7 custom tables, 5 custom post types, 36 account-area endpoints, 4 REST endpoints, 21 AJAX handlers, 5 asynchronous or scheduled jobs, 6 external services integrated, 14 technical and operational documents.

Technologies

  • PHP
  • JavaScript
  • MySQL
  • WordPress
  • WooCommerce
  • WooCommerce Subscriptions
  • OpenAI
  • Stripe
  • Amazon S3
  • Aruba e-invoicing
  • Amelia