Skip to content

Data Model

Macadam uses Dexie.js (v4) over IndexedDB. The database is called MacadamVault and is defined in static/db.js.

One row per work week.

FieldTypeIndexedNotes
idNumberPK, auto-incrementDexie ++id
week_noNumberYesSequential week number (user-assigned)
start_dateStringYesISO date YYYY-MM-DD
end_dateStringYesISO date YYYY-MM-DD
hours_workedNumberNoDecimal hours (e.g. 32.5)
active_hoursNumberNoOptional. Active (on-delivery) hours
deliveriesNumberNoCount of deliveries completed
doordash_payNumberNoPlatform base pay
tipsNumberNoCustomer tips
other_payNumberNoBonuses, promos, other platform pay
paid_out_of_pocketNumberNoExpenses paid directly during the week
notesStringNoFree-text

Total earnings for a week = doordash_pay + tips + other_pay.

Individual expense line items.

FieldTypeIndexedNotes
idNumberPK, auto-incrementDexie ++id
dateStringYesISO date YYYY-MM-DD
category_idNumberYesLegacy index (not actively used in queries — category name is stored directly)
categoryStringNoCategory name (e.g. "Fuel")
amountNumberNoDollar amount
descriptionStringNoMerchant or short note
receiptStringNoWhere to find the receipt
notesStringNoFree-text

Lookup table for category names. Seeded on first launch.

FieldTypeIndexedNotes
idNumberPK, auto-incrementDexie ++id
nameStringUniquee.g. "Fuel", "Taxes/Fees"

Default seed values: Fuel, Maintenance, Supplies, Insurance, Phone/Data, Taxes/Fees.

New categories are created on the fly when a user types a name that does not exist in the datalist during expense entry (ensureCategory() in expenses_vault.js).

Key-value store for application preferences.

FieldTypeIndexedNotes
keyStringPKSetting name
valueanyNoSetting value

Default seed values:

KeyDefault Value
currency_symbol$
default_rangeall
app_nameMacadam

The database is currently at version 1. Dexie handles schema migrations automatically via db.version(N).stores(...). When adding new indexed fields or stores in the future, increment the version number and add a new .version(2).stores(...) block. Non-indexed fields can be added freely without a version bump.