ApexEloquent Guide

ApexEloquent is the central OSS of Apex Stem — handling SOQL and DML through a "typed, composable query builder" and a "DI-aware data access layer". Structured in four tiers: Setup (prerequisites and installation), Guide (how to use it in production code), API Reference (the full API of each class), and Deep Dives (the motivations behind the design).

About versions

There are two current lines, v3 and v2. The only difference is the execution mode: on the v3 line, SOQL and DML default to user mode, honouring the running user's field and object permissions. Everything else is the same.

These guides are written as shared content, calling out only the mode difference where it matters. You can check which version you are on with:

git -C force-app/main/default/classes/ApexEloquent describe --tags

Deep Dives

Reading material that digs into why ApexEloquent ended up in this form — the design philosophy, the Repository pattern's resting place in Apex, migration from raw SOQL, and more.

Deep Dive

Query Delegation Pattern

The design philosophy of ApexEloquent. Starting from the long-term operational challenges of the Selector Pattern, the article lays out what problems are solved by separating query construction from execution, and how Scribe / IEloquent / IEntry embody that.

ArchitectureDesign PatternSelector
Deep Dive

The Repository Pattern in Apex: Trial, Error, and Going Built-In

What happens when you write the Repository pattern naively in Apex, how it relates to Salesforce's official Selector Pattern, and why ApexEloquent ships a "built-in Repository" as IEloquent — contrasting the official benefits against long-term operational side effects.

SelectorRepositoryBuilt-in Repository
Deep Dive

From Raw SOQL to a Chained-Method ORM in Apex

A migration primer that walks through the cost we're paying in raw-SOQL-centric Apex development (readability / dynamic conditions / type safety / relations / testing), and how Scribe + IEloquent lighten that load — example-based.

SOQLScribeMigration
Deep Dive

MockEntry: How Apex Test Data Construction Becomes Possible

A comprehensive look at how MockEntry's override map, SELECT-omission detection, setParent / setChildren, the times placeholder, and aggregate-result mocking resolve the two great difficulties of Apex testing: non-writable fields (formula / rollup / auto-number / relationship names) and the difficulty of building parent-child structures.

MockEntryTest DataNon-writable Fields
Deep Dive

Catching Mock-Test False Positives: A Safety Net for SELECT Omissions

Demonstrates how ApexEloquent structurally closes the "passes in tests, fails in production" type of false-positive problem through Scribe coordination — proven with real-code pairs of "buggy Usecase + the test that catches it" across four cases (primary object / parent relation / child subquery / aggregate alias).

False PositiveSELECT OmissionTesting

Read Next