Skip to content

Architecture: Bootstrap Notes

{/* AUTO-GENERATED from ../docs/architecture-bootstrap-notes.md by scripts/sync-dev-docs.mjs — do not edit by hand. */}

This short guide explains how the plugin boots, where core responsibilities live, and where integrators should add new behavior.

  1. dino-discounts.php wires activation/deactivation hooks, compatibility flags, and the main plugin bootstrap.
  2. includes/Plugin.php registers core services (REST, storefront hooks, migrations, assets, admin wiring).
  3. REST controllers are registered under dino-discounts/v1 and gate access through AbstractController::check_permission().
  4. Rule evaluation happens through RulesEngine, with targeting logic delegated to TargetingEvaluator.
  • includes/Engine/: rule matching, targeting, reward strategy selection, and runtime guards.
  • includes/Cart/: campaign and coupon-code lifecycle, linking, export, and redemption state.
  • includes/API/: admin and debug endpoints used by the React UI.
  • includes/Storefront/: cart/checkout rendering and runtime storefront behavior.
  • src/components/: admin application UI, wizard, campaigns, preview, and shared controls.
  • Prefer extending existing services/controllers over introducing new static utilities.
  • Add tests for behavior-heavy changes in tests/Unit before moving UI or endpoint wiring.
  • When changing UI request flows, use apiFetch and expose explicit user-facing error states.
  • For complex rule/campaign edits, keep pure transformation helpers small and isolated so they are testable.