Salesforce Dictionary - Free Salesforce GlossarySalesforce Dictionary
Salesforce Developer
medium

What is the Apex Recipes repository and what patterns does it teach?

Apex Recipes (https://github.com/trailheadapps/apex-recipes) is Salesforce's open-source collection of canonical Apex code patterns — reference implementations for common scenarios.

Categories covered:

  • Trigger handler frameworks — one trigger per object delegating to a handler.
  • Async patterns — Queueable, Batch, Scheduled with proper testing.
  • Callout patterns — REST callouts with mocking, retries, error handling.
  • DML patterns — bulkified, allOrNone, partial-success.
  • Test patterns@TestSetup, factories, Test.startTest/stopTest, mocks.
  • LWC + Apex@AuraEnabled, @wire, imperative.
  • Integrations — Platform Events, Change Data Capture, scheduled jobs.

Why it matters:

  • Reference for "how does Salesforce intend this to be used" — patterns endorsed by Salesforce.
  • Code review baseline — when team disagreement arises, "Apex Recipes does it this way" is a useful arbiter.
  • Onboarding — new Salesforce devs can read it cover-to-cover.
  • Continuously updated — new patterns added with new platform features (e.g., Pub/Sub API, LWC patterns).

Companion: LWC Recipes, Postman Collection for Salesforce APIs, Trailhead Apex Specialist — together a comprehensive learning curriculum.

What it teaches that's easy to miss:

  • `Database.AllowsCallouts` marker for async classes that callout.
  • Custom exceptions inheriting Exception.
  • `System.runAs` for permission tests.
  • Mockable interfaces via dependency injection.
  • Fflib_ApexMocks for stubbing at scale (separate library).

If a candidate hasn't browsed Apex Recipes, that's a red flag for senior roles — it's the de facto Salesforce-best-practice playbook.

Why this answer works

Tests Salesforce community awareness. Naming Apex Recipes by repository signals genuine engagement with the ecosystem.

Follow-ups to expect

Related dictionary terms