# Coding Standards Status: Mandatory Date: 2026-07-03 ## Core Principles - Keep modules small and cohesive. - Prefer pure functions where possible. - Prefer composition over inheritance. - Prefer configuration over conditionals. - Avoid duplication; extract shared behavior above 70 percent overlap. ## Type Safety - No any in domain and configuration contracts. - Strict typing for API payloads and configuration schemas. - Use discriminated unions for widget and section types. ## Error Handling - Errors normalized at service/integration boundaries. - UI displays user-safe messages from facades/view models. - No unhandled promise rejections. ## API and IO - IO is performed in services/integrations only. - Use facades to orchestrate calls and map outputs. - Keep presentation layer side-effect free. ## Testing Expectations - Unit tests for facades, services, and mapping logic. - Contract tests for bootstrap schema compatibility. - Boundary tests for forbidden imports. ## Review Checklist - Does this code violate layer boundaries? - Is tenant behavior configuration-driven? - Is logic duplicated and extractable? - Are auth/payment contracts unchanged? - Is the app still compilable?