DEV Community

weiweriuser
weiweriuser

Posted on

Pantry Ledger: when six eggs become two

Sanity Challenge Path Two Submission

This is a submission for the Sanity Challenge, Path Two: Vibe-Code Something Strange.

What I Built

Pantry Ledger is a small bilingual app for a simple problem: a pantry note says there are six eggs, but a later correction says there are only two. The app keeps both records and shows how that correction changes which meals have enough ingredients.

It is for people who want to inspect the evidence behind a meal-planning decision. The current version uses fictional quantities only. It is a software demonstration, not nutrition advice or a complete meal planner.

Demo

Open Pantry Ledger

No login is required. Click Load live to read the public Sanity dataset. Select Before: the original six-egg observation is enough for a three-egg dish. Select After: the correction leaves two eggs, so the dish is one egg short. Rice stays available. Tofu stays marked for review because “half a pack” does not establish its weight.

The interface labels local demo data and a successfully loaded online snapshot separately. Switching between Before and After only changes the current browser view; it does not update the database.

Code

GitHub repository

The repository includes the deployed static output and source.zip, containing the application source, dependency lockfile, fictional seed records, and tests.

My Build Process

An earlier implementation had unresolved dependency findings. The published version uses a clean Next.js dependency tree and omits the unused Studio application. The final implementation passed 28 functional and data-validation tests. Its dependency audit reported no known advisories at the time checked on October 3, 2026. That is a point-in-time result, not a guarantee of security.

The live integration exposed another issue: importing records did not automatically allow the deployed website to read them. Requests from the GitHub Pages origin received 403 responses. Adding that exact origin in Sanity, with credentials disabled, made the browser read succeed. After import, the temporary Editor token was revoked and live reading was tested again successfully.

Sanity Project Details

  • Project ID: zmcwbews
  • Public dataset: production
  • Frontend: Next.js static export with React
  • Storage: Sanity Content Lake, queried with GROQ

The dataset contains 12 fictional documents: four ingredients, five observations, and three meals. Observation documents refer to ingredients. A correction refers to the observation it supersedes. Meal requirements refer to ingredients and specify units and quantities. Explicit relationships make the correction inspectable instead of silently replacing the original record.

The reader validates the document structure and references before displaying data. Known mass units can be converted, but grams are not converted into counts. Incomplete quantities stay uncertain. The browser sends no authentication credentials and has no write capability.

Current Scope

This version uses snapshot reads, not a real-time subscription. It does not use Sanity App SDK, Workflows, Knowledge Bases, or an agent answering through MCP. No claim of independent user testing or measured household savings is made. A useful next improvement would be an editing workflow that lets a person review and publish corrections while preserving their source records.

Pantry Ledger displaying a Sanity live snapshot after token revocation

Top comments (0)