Build your own MileIQ

Build your own MileIQ with a focused data model, build prompts and recovery checks. Keep the first version small enough to understand and maintain.

  • vibe-coding

Build your own MileIQ as a mileage ledger you fill in yourself. Enter the date, trip purpose, start and end odometer readings. Calculate distance and export the records you choose to keep.

Start with the MileIQ catalog prompt. The useful boundary is manual recordkeeping. Automatic trip detection adds background location collection, battery use and missed-trip recovery.

Build your own MileIQ with odometer readings

Store readings as integers in the smallest unit you support. If you allow tenths of a kilometre, 120.4 becomes 1204. Save the unit on the vehicle so a later display preference cannot reinterpret the original reading.

Here is a complete calculation you can run with Node.js:

const start = 1204
const end = 1347
if (end < start) throw new Error('End reading precedes start')
const distance = (end - start) / 10
console.log(distance)

This prints 14.3. Reject a negative distance at the server too. A browser input constraint cannot protect an import or a direct request.

Keep the trip separate from its classification

A distance is a measurement. Business or personal is a classification you assign. Store both so correcting the classification never changes the odometer history.

Vehicle(id, owner_id, label, unit)
Trip(id, vehicle_id, trip_date, start_tenths, end_tenths, purpose,
     classification, revision)

Use a local calendar date for the day of travel. Keep a separate UTC timestamp for when you entered it. A trip written after midnight should still belong to the date you selected.

Ask for a ledger before adding maps

Build a private manual mileage ledger using Astro, HTMX, Alpine.js and SQL.
Each vehicle has a fixed measurement unit. Validate nonnegative readings,
end at least start, trip date, and a short purpose. Show daily and monthly
distance totals by classification. Export original readings and units.
Do not capture location, estimate tax deductions, or connect bank accounts.

Create two vehicles using different units. The monthly view must group their totals or explicitly convert them using a documented rule. Adding kilometres and miles into one unlabeled number is a data bug.

Make corrections visible

Add a revision to the trip row. If two tabs edit the same trip, accept one and show a conflict for the other. Keep the unsaved purpose text available after the conflict.

An export should include both readings, calculated distance and the selected unit. Include trip identifiers so importing the same file twice can refuse duplicates. Quote CSV fields and protect spreadsheet consumers from text beginning with formula characters.

Fixture Expected result
End below start Validation error, no write
Same readings Zero distance shown explicitly
Two different units Separate labeled totals
Repeated import No duplicate trip

The first scope covers manual trips. The next adds a reviewed import and restore. Replacing automatic capture means maintaining native software and background location behavior. Keep those costs separate from a small personal ledger.

The Toggl post covers another manual log, and the scope guide helps decide which estimate fits your own use.