DEV Community

Sunayana Yakkala
Sunayana Yakkala

Posted on

PetPal — A Local-First Pet Food Safety Checker

This is a submission for the Hacktoberfest Weekend Challenge: Build for a Friend.

What I Built

I built PetPal, an open-source pet food safety checker designed for pet owners who constantly find themselves asking:

"Can my pet eat this?"

Pet owners often have to search through multiple websites, forums, and conflicting sources just to determine whether a particular food is safe for their pet.

PetPal makes this simpler. You select an animal, enter a food, and receive a clear verdict:

  • Safe
  • Caution
  • Unsafe
  • Unknown

The important part is that PetPal doesn't blindly trust AI. It uses a layered approach, prioritizing reliable sources first:

  1. A curated veterinary food-safety database
  2. Open Pet Food Facts for foods that aren't in the local dataset
  3. An open-weight AI model running locally through Ollama for unknown foods
  4. An honest Unknown result when there isn't enough information

Every answer also identifies its source, so users can understand where the verdict came from.

PetPal currently supports 10 species: dogs, cats, rabbits, hamsters, birds, turtles, fish, lizards, snakes, and chickens.

I built it with a pet owner in mind who wants quick answers about their pet's food without having to rely on random internet searches or send every question to a cloud AI service.

Demo

GitHub Repository:

https://github.com/Sunayana225/hactoberfestproject1

A live deployed demo is not currently included in the repository. PetPal can be run locally with the web client, backend, and optional mobile client.

Code

GitHub:

https://github.com/Sunayana225/hactoberfestproject1

The repository contains:

  • React + Vite + Tailwind web application
  • Expo / React Native mobile application
  • Express + TypeScript backend
  • SQLite-backed authentication and API-key management
  • Veterinary and open food-safety datasets
  • Local AI inference through Ollama
  • Optional Gemini cloud fallback
  • Automated tests with Jest and Vitest
  • API rate limiting, authentication, usage tracking, and monitoring

How I Built It

The core of PetPal is an open-weight AI model running locally through Ollama.

The AI layer is implemented behind an AIProvider abstraction, allowing the application to switch between:

  • Ollama for local open-weight inference
  • Gemini for optional cloud inference
  • An automatic mode that prefers local inference

The default setup uses Ollama with llama3.2, but the model can be changed through an environment variable to models such as qwen2.5, gemma3, mistral, or phi4.

The application deliberately does not send every question directly to an AI model.

Instead, PetPal follows a data-first pipeline:

User → Veterinary/Open Dataset → External Open Dataset → Local AI → Unknown

This makes the AI a fallback rather than the source of truth.

For unknown foods, the local model produces a clearly labelled answer. These AI-generated answers are then placed into a human review queue instead of being silently added to the trusted dataset. Approved answers can eventually become part of the application's knowledge base.

The project uses:

  • Backend: Express, TypeScript, SQLite
  • Web: React, Vite, Tailwind CSS
  • Mobile: Expo, React Native, TypeScript
  • AI: Ollama + open-weight models
  • Optional cloud AI: Gemini
  • Testing: Jest, Supertest, Vitest
  • Data: Curated veterinary data, BioVet, Growli/ASPCA plant-toxicity data, and generated seed data

The project also includes a developer API with authentication, API keys, quotas, usage tracking, and protected dataset endpoints.

Why Does Open Innovation Matter?

Open innovation is central to PetPal rather than being an additional feature.

A closed cloud AI API would have made the initial implementation easier, but it would have introduced several limitations.

With a closed cloud model:

  • The application needs an internet connection for AI answers.
  • Users need access to an API key or account.
  • Pet-related questions have to leave the user's device.
  • Every AI request can incur a cost.
  • Developers cannot freely change or experiment with the underlying model.

Using an open-weight model through Ollama changes those assumptions.

PetPal can run locally, without requiring an AI API key, and without sending the user's questions to a third-party AI provider. The model can also be swapped simply through configuration.

More importantly, the open approach makes the system extensible. Developers can inspect the runtime, change the model, modify the prompts, and eventually fine-tune a model using the application's human-reviewed answers.

This creates a potential feedback loop:

AI answer → Human review → Vetted data → Better local model

That would be difficult to achieve with a closed API where the underlying model and training process are controlled by the provider.

For PetPal, open innovation therefore isn't just about avoiding API costs. It enables privacy by architecture, offline use, model choice, inspectability, and a path toward community-driven improvement.

My Agent Session

Not included yet.

Prize Categories

  • Build for a Friend
  • Open-Source AI / Open Innovation

Top comments (0)