shredbx logo
shredbx shredbx shredbx shredbx Personal
  • Home
  • Lab
  • Portfolio
  • Experience
  • Services
  • Profile
  • Contact
AClaude
  • Home
  • Lab
  • Portfolio
  • Experience
  • Services
  • Profile
  • Contact
Andrei Solovev
Knowledge
Search knowledge... ⌘K
Knowledge · Guidelines · architecture

Shared Type Patterns

Patterns for creating shared types used across multiple projects — attribute split, field mapping, fixtures

Andrei Solovev

Metadata

architecture preferred

Procedures

Showing 3 of 5

  1. 1 Identify all projects that use this type
    Before creating a shared type, scan the workspace for all entity definitions
    that represent the same domain concept:
    
      find .sbx/workspace/clients -name "entity.yml" | xargs grep "name: {type}"
      find .sbx/workspace/projects -name "entity.yml" | xargs grep "name: {type}"
    
    Compare attribute lists across all found entity definitions.
    Group into: SHARED (same across all) vs PROJECT-SPECIFIC (unique to one).
  2. 2 Define the shared attribute set
    Shared attributes go into the type package entity.yml.
    Rules for inclusion:
    
      INCLUDE if: attribute exists in 2+ project entity definitions
      INCLUDE if: attribute is fundamental to the domain concept (even if only 1 project uses it now)
      EXCLUDE if: attribute is project-specific business logic (house_rules, transaction_type)
      EXCLUDE if: attribute only makes sense in one market (title_deed = Thai real estate only)
    
    When two projects use DIFFERENT NAMES for the same concept:
      bestays "name" vs bestierealestate "title" → shared as "display_name"
      bestays "base_price" vs bestierealestate "price" → shared as "price"
    
    Pick a canonical name that is domain-neutral.
  3. 3 Handle project-specific attributes
    Project-specific attributes stay in the project's entity.yml.
    The project entity declares: type_category: {shared_type}
    
    Pattern:
      # .sbx/workspace/clients/{client}/projects/{project}/entities/{type}/entity.yml
      type: entity
      name: {type}
      type_category: {shared_type}    # references shared type package
      purpose: {project-specific purpose}
    
      # Only project-specific attributes listed here
      attributes:
        amenities: ...      # bestays-specific
        transaction_type: ... # bestierealestate-specific
    
    The shared type's attributes are implicitly inherited via type_category.
shredbx logo shredbx shredbx shredbx shredbx Andrei Solovev

Solution Architect & Lead Software Engineer

ExperiencePortfolioResearch & ExperimentsEducationCertificationSkills
GitHub ↗LinkedIn ↗Email ↗
AVAILABLE FOR NEW PROJECTS
// MY LATEST BEATS
Hobby & Interests

Lab

  • The Lab
  • Framework
  • Components
  • Packages
  • Games
  • Process (SDLC)
  • Knowledge
  • Blog

Andrei

  • Portfolio
  • Experience
  • Services
  • Profile
  • Contact
  • Lifestyle

Team

  • Team
  • Andrei
  • Claude

Legal

  • Privacy
  • Terms
  • Cookies
© 2026 shredbx.com. All rights reserved. — Andrei Solovev |