Enterprise Apex without the ceremony.
sf-bedrock gives Salesforce teams a small set of readable frameworks for background work, durable events, recurring jobs, and routed REST APIs. Around them is a practical toolkit for fast tests, clean data seams, and platform-safe automation.
Why Bedrock
Enterprise Salesforce code needs structure, but structure should not bury the business logic. Bedrock separates the big repeatable platform problems into frameworks, then keeps the day-to-day helpers small enough to adopt one at a time.
Frameworks for platform pressure
Use shared patterns for async work, events, schedules, and APIs instead of rebuilding platform edge-case handling in every service.
Tools for everyday code
Keep records, queries, DML, cache, flags, and trigger flow testable without dragging heavy ceremony into production classes.
Tests that stay fast
Mock reads, writes, cache, limits, and scheduled or async boundaries so unit tests prove behavior without slow database setup.
Open source by design
Bedrock is MPL-2.0 licensed, so teams can inspect, adopt, and improve the source without treating the foundation as a black box.
The Headliners
Async
Record-driven background work with tracked status, tuned batches, bounded retry, priority, staging, and multithreaded throughput when a straight Queueable chain is not enough.
EventRelay
Durable Platform Event publication and ingestion. Payloads become tracked work items, lanes preserve order, and handlers or publishers can retry without hiding failures in trigger transactions.
Scheduler
One fixed heartbeat drives metadata-configured logical jobs, keeping recurring Apex work visible without spending scheduled-job slots on every task.
REST
A versioned Apex REST gateway that routes metadata-configured endpoint roots into focused classes, with request context parsing and a testable endpoint surface.
The Full Toolkit
The rest of Bedrock supports those frameworks and improves normal Apex service code. Each tool is deliberately narrow, mockable, and useful on its own.
- TestData Build realistic in-memory SObjects, including Ids, formulas, audit fields, and parent relationships.
- DML / Query Route writes and reads through small seams so tests can assert behavior without touching the database.
- Selector Reusable Id-based data access with transaction caching and cache-key discipline.
- TriggerHandler Centralize trigger context dispatch so domain hooks stay focused on lifecycle behavior.
- RecordBuffer Stage records across a transaction, then flush grouped inserts and updates at a controlled point.
- Generic Read, write, coerce, and map deeply nested untyped JSON without a maze of casts and key checks.
- FeatureFlag Metadata-driven toggles that fail closed and remain easy to override in tests.
- PlatformCache Use org and session cache through a mockable wrapper instead of binding tests to platform cache behavior.
- Limiter Guard work with named limits and a mockable contract for tests that need to prove throttling behavior.
- Pluck Turn record lists into deduped Id sets that feed list-driven services and framework APIs.
How It Fits
Bedrock works best when each layer owns a clear kind of responsibility. The frameworks coordinate platform behavior. The tools keep the code inside those layers readable, replaceable, and easy to test.
Domain
Triggers and record lifecycle automation stay thin with TriggerHandler, RecordBuffer, and list helpers such as Pluck.
Service
Business services coordinate work through DML, Query, feature flags, cache, and the framework that matches the platform problem.
Operations
Async, EventRelay, and Scheduler make background work visible enough to tune, retry, and support.
Interface
REST keeps API routing in one gateway, while UI controllers and endpoint classes stay focused on adapting requests to services.
Start Building
If you are evaluating Bedrock, begin with the testing foundation:
TestData, DML, and Query. Once
those seams feel natural, reach for the framework that matches your next
platform problem.
Getting Started
Install the library, understand the docs structure, and take the shortest path into a working Bedrock pattern.
Bedrock Console
Use the console docs when you want to inspect Async, EventRelay, REST, and Scheduler work from a Salesforce-facing interface.
Testing Foundation
Start with TestData, DML, and Query to make fast, database-light Apex tests feel normal.
Frameworks
Jump into Async, EventRelay, Scheduler, or REST when platform behavior needs a shared pattern.