Skip to content

Data Model

A Ref is the universal base unit in Pelagora. Every listing — whether it's a car, a guitar, or a restaurant voucher — is a Ref. Refs are Schema.org-compatible so they can be understood by search engines, LLMs, and third-party platforms.

Base Fields

Every Ref has these universal fields:

FieldTypeDescription
idstringUnique identifier (UUID)
namestringDisplay name (Schema.org: name)
descriptionstringFree-text description (Schema.org: description)
categorystringTop-level category (e.g., "Vehicles")
subcategorystringSubcategory (e.g., "Cars")
listingStatusenumVisibility: private, for_sale, willing_to_sell, archived_sold, archived_deleted
quantitynumberUnits available
skustring?Optional SKU or serial number
conditionstring?Category-appropriate condition value
attributesobject?Category-specific attributes (JSON)
beaconIdstringPublic key of the owning node
createdAtstringISO 8601 creation timestamp
updatedAtstringISO 8601 last-modified timestamp

Location Fields

FieldTypeDescription
locationLatnumber?Latitude
locationLngnumber?Longitude
locationAddressstring?Street address (stored locally only, never shared over DHT)
locationCitystring?City
locationStatestring?State/province
locationZipstring?Zip/postal code
locationCountrystring?Country code
sellingScopeenum?global, national, or range
sellingRadiusMilesnumber?Radius in miles (when scope = range)

Sync Fields

FieldTypeDescription
reffoSyncedbooleanWhether this Ref is synced to the Reffo platform
reffoRefIdstring?The Ref ID on the platform (if synced)

Trait System

Refs compose behavior through traits — capability labels that describe what a Ref supports. Traits document the category's data shape.

TraitDescription
PriceableHas a price and currency. Can receive offers.
ConditionalHas a condition field with category-appropriate values.
ValueableHas appraised or market value significance.
SerializedHas a unique serial/identification number (VIN, IMEI, parcel ID).
LocationBoundPhysical location matters for the transaction.
ConsumableUsed up or redeemed (gift cards, vouchers).
TimeBoundedHas an expiration or validity window.

Category Composition

Each category defines which traits apply:

CarRef       = Ref + Priceable + Conditional + Valueable + Serialized + LocationBound
HousingRef   = Ref + Priceable + Conditional + Valueable + Serialized + LocationBound
PhoneRef     = Ref + Priceable + Conditional + Valueable + Serialized
ArtRef       = Ref + Priceable + Conditional + Valueable
FurnitureRef = Ref + Priceable + Conditional + LocationBound
DiningRef    = Ref + Priceable + Consumable + TimeBounded + LocationBound

Listing Status Flow

private  ──►  for_sale  ──►  archived_sold
   │              │
   │              ▼
   │        willing_to_sell
   │              │
   ▼              ▼
archived_deleted  archived_sold
  • private: Not visible to other nodes or the network.
  • for_sale: Actively listed with a price. Discoverable via DHT.
  • willing_to_sell: Open to offers but no fixed price. Discoverable.
  • archived_sold: Transaction completed. No longer discoverable.
  • archived_deleted: Removed by owner. No longer discoverable.

Privacy Tiers

TierWhat's sharedWhere
Local onlyFull address, exact lat/lngStored in node SQLite, never transmitted
DHT (blurred)City, state, zip, blurred lat/lng (~0.7 mi precision)Shared with peers via Hyperswarm
Platform (synced)City, state, zip, blurred lat/lng, Schema.org dataStored in Supabase when sync is enabled

The blurLocation() function rounds coordinates to 2 decimal places (~0.7 mile / zip-code precision) before any network transmission.

Schema.org Compatibility

Every Ref maps to a Schema.org type. The attributes object holds category-specific fields, and the buildSchemaOrg() function transforms them into standard JSON-LD:

json
{
  "@type": "Car",
  "name": "2020 Toyota Camry XLE",
  "description": "One owner, clean title, dealer maintained",
  "vehicleModelDate": "2020",
  "brand": { "@type": "Brand", "name": "Toyota" },
  "model": "Camry",
  "mileageFromOdometer": {
    "@type": "QuantitativeValue",
    "value": 45000,
    "unitCode": "SMI"
  },
  "vehicleTransmission": "automatic",
  "offers": {
    "@type": "Offer",
    "price": 18500,
    "priceCurrency": "USD"
  }
}

See the Schema.org guide for the full mapping reference and the Adding Categories guide for extending the schema system.

Released under the MIT License.