Create a User Profile Schema

For your eBay-style marketplace repository, I'd define a canonical User Profile Schema that all buyer, seller, business, moderator, and admin accounts inherit from.

---
id: usr_000000

# Identity
type: user
accountType: buyer # buyer | seller | business | moderator | admin
accountStatus: active # active | suspended | restricted | pending | banned

# Profile
username:
displayName:
firstName:
lastName:
bio:

avatar:
banner:

# Contact
email:
emailVerified: false

phone:
phoneVerified: false

website:

# Verification
identityVerified: false
businessVerified: false
addressVerified: false

# Account History
memberSince:
lastLogin:
lastActive:

# Location
location:
  country:
  state:
  city:
  postcode:
  timezone:

# Seller Information
seller:
  enabled: false
  storeId:
  sellerLevel:
  topRatedSeller: false

# Marketplace Reputation
feedback:
  score: 0
  totalReviews: 0
  positivePercentage: 0
  positive: 0
  neutral: 0
  negative: 0

# Activity Metrics
activity:
  purchasesCompleted: 0
  salesCompleted: 0
  listingsCreated: 0
  auctionsCreated: 0
  offersSent: 0
  offersReceived: 0
  returnsOpened: 0
  disputesOpened: 0

# Commerce
watchlistCount: 0
savedSearchCount: 0
cartCount: 0

# Membership
membership:
  tier: standard
  startedAt:
  expiresAt:

# Permissions
permissions:
  - buyer

roles:
  - user

# Notification Preferences
notifications:
  email: true
  sms: false
  push: true

# Privacy Settings
privacy:
  profileVisible: true
  showLocation: true
  showFeedback: true
  searchableProfile: true

# Security
security:
  twoFactorEnabled: false
  loginAlerts: true
  trustedDevices: []

# Preferences
preferences:
  currency: AUD
  language: en-AU
  darkMode: false

# Analytics
analytics:
  track: true

# SEO
seo:
  title:
  description:
  keywords: []

# Metadata
version: 1.0.0
createdAt:
updatedAt:
---

Buyer Extension

buyer:
  preferredCategories: []
  followedStores: []
  savedSearches: []
  watchlists: []

Seller Extension

seller:
  enabled: true
  storeId:
  inventoryCount: 0
  activeListings: 0
  lifetimeRevenue: 0
  sellerLevel:
  topRatedSeller: false

sellerMetrics:
  shippedOnTime: 0
  orderDefectRate: 0
  cancellationRate: 0

Business Extension

business:
  businessName:
  abn:
  gstRegistered: false

  supportEmail:
  supportPhone:

  warehouseLocations: []

Recommended Structure

content/
└── users/
    ├── buyers/
    │   └── john-smith.md
    ├── sellers/
    │   └── tech-store.md
    ├── businesses/
    │   └── global-electronics.md
    ├── moderators/
    └── administrators/

This schema provides a single source of truth for all marketplace user data while remaining compatible with the product, auction, order, feedback, message, store, and watchlist schemas you've been building in the current repository.

For the User Profile Schema in your current document, I'd add a companion validation schema that your frontmatter generator, CI pipeline, and CMS can enforce.

User Schema Validation Rules

validation:
  id:
    required: true
    pattern: "^usr_[a-zA-Z0-9]+$"

  type:
    required: true
    enum:
      - user

  accountType:
    required: true
    enum:
      - buyer
      - seller
      - business
      - moderator
      - admin

  accountStatus:
    required: true
    enum:
      - active
      - pending
      - suspended
      - restricted
      - banned

  username:
    required: true
    minLength: 3
    maxLength: 32
    pattern: "^[a-zA-Z0-9_-]+$"

  displayName:
    required: true
    minLength: 1
    maxLength: 100

  firstName:
    maxLength: 100

  lastName:
    maxLength: 100

  email:
    required: true
    format: email

  website:
    format: uri

  phone:
    pattern: "^\\+?[0-9 ]+$"

  memberSince:
    format: date

  lastLogin:
    format: date-time

  lastActive:
    format: date-time

Feedback Validation

feedback:
  score:
    type: integer
    minimum: 0

  totalReviews:
    type: integer
    minimum: 0

  positivePercentage:
    type: number
    minimum: 0
    maximum: 100

  positive:
    type: integer
    minimum: 0

  neutral:
    type: integer
    minimum: 0

  negative:
    type: integer
    minimum: 0

Activity Validation

activity:
  purchasesCompleted:
    type: integer
    minimum: 0

  salesCompleted:
    type: integer
    minimum: 0

  listingsCreated:
    type: integer
    minimum: 0

  auctionsCreated:
    type: integer
    minimum: 0

  offersSent:
    type: integer
    minimum: 0

  offersReceived:
    type: integer
    minimum: 0

Seller Validation

seller:
  enabled:
    type: boolean

  storeId:
    pattern: "^store_[a-zA-Z0-9]+$"

  sellerLevel:
    enum:
      - standard
      - above-standard
      - top-rated
      - enterprise

  topRatedSeller:
    type: boolean

Location Validation

location:
  country:
    required: true

  state:
    required: false

  city:
    required: false

  postcode:
    maxLength: 20

  timezone:
    required: true

Commerce Validation

watchlistCount:
  type: integer
  minimum: 0

savedSearchCount:
  type: integer
  minimum: 0

cartCount:
  type: integer
  minimum: 0

Permissions Validation

permissions:
  type: array

  items:
    enum:
      - buyer
      - seller
      - moderator
      - admin
      - support
      - system

Security Validation

security:
  twoFactorEnabled:
    type: boolean

  loginAlerts:
    type: boolean

  trustedDevices:
    type: array
    maxItems: 100

Marketplace Business Rules

businessRules:

  - if:
      accountType: seller
    then:
      require:
        - seller.storeId

  - if:
      accountType: business
    then:
      require:
        - business.businessName

  - if:
      identityVerified: true
    then:
      require:
        - firstName
        - lastName

  - if:
      seller.topRatedSeller: true
    then:
      validate:
        feedback.positivePercentage: ">=98"

  - if:
      accountStatus: banned
    then:
      permissions: []

JSON Schema Equivalent

For runtime validation I'd generate:

schemas/
├── user.schema.json
├── buyer.schema.json
├── seller.schema.json
├── business.schema.json
├── address.schema.json
├── watchlist.schema.json
├── feedback.schema.json
├── store.schema.json
├── order.schema.json
└── auction.schema.json

and validate all markdown frontmatter during CI using:

npm run validate-content

This ensures every user profile in the marketplace repository follows strict identity, seller reputation, permissions, privacy, security, and marketplace business-rule validation before deployment.

← All posts