DEV Community

krile 136cm
krile 136cm

Posted on

ApexEloquent v1.0 – An Apex ORM Framework with True DB-Free Unit Testing

I’m excited to announce the release of ApexEloquent v1.0, an open-source ORM framework for Salesforce Apex (Apache 2.0).

Inspired by Laravel’s Eloquent, it’s designed specifically for Salesforce developers to make working with SOQL and relationships easier, safer, and fully testable.

Why ApexEloquent?

Many Salesforce developers face these common pain points:

  • Verbose and brittle SOQL queries
  • Complex parent/child/many-to-many relationship handling
  • Slow and fragile database-dependent unit tests

ApexEloquent solves these by providing:

  • Fluent & safe query construction – write queries like natural sentences
  • Effortless relationship handling – access parent, child, and junction objects intuitively
  • True DB-free unit testingMockEloquent lets you run fast, isolated tests without any DML or SOQL

Quick Example

// Fetch Opportunities with Amount > 100,000
Scribe scribe = Scribe.source(Opportunity.getSObjectType())
    .fields(new List<String>{'Id','Name','Amount'})
    .whereGreaterThan('Amount', 100000);

List<IEntry> opps = (new Eloquent()).get(scribe);
Enter fullscreen mode Exit fullscreen mode

With MockEloquent, the same queries can be tested without touching the database, making your unit tests faster and more reliable.

Learn More

I’d love to hear feedback from the community!

Have you tried similar ORM approaches in Apex? How do you handle database-independent testing in your projects?

Top comments (0)