Open-Awesome
CategoriesAlternativesStacksSelf-HostedExplore
Open-Awesome

© 2026 Open-Awesome. Curated for the developer elite.

TermsPrivacyAboutGitHubRSS
  1. Home
  2. Salesforce
  3. Apex Commons

Apex Commons

BSD-3-ClauseApex

A comprehensive Apex library implementing enterprise patterns like Service Layer, Domain, Selector, and Unit of Work for Salesforce development.

GitHubGitHub
1.0k stars569 forks0 contributors

What is Apex Commons?

FFLib Apex Common is an open-source Apex library that implements enterprise application patterns like Service Layer, Domain, Selector, and Unit of Work for Salesforce development. It provides a structured framework to build scalable, maintainable, and testable Apex code by separating concerns and managing platform resources efficiently.

Target Audience

Salesforce developers and architects building complex, enterprise-grade applications on the Force.com platform who need a standardized approach to application architecture.

Value Proposition

Developers choose FFLib Apex Common because it offers a battle-tested, community-driven implementation of enterprise patterns specifically tailored for Salesforce's governor limits and security model, reducing boilerplate code and improving code quality.

Overview

Common Apex Library supporting Apex Enterprise Patterns and much more!

Use Cases

Best For

  • Implementing a clean architecture in Salesforce with separated business logic layers
  • Managing complex database transactions and DML operations efficiently
  • Centralizing and securing SOQL queries with field-level stripping
  • Building testable Apex applications with mockable service and domain layers
  • Enforcing CRUD/FLS and sharing rules in Apex code systematically
  • Migrating legacy Salesforce code to a more maintainable enterprise pattern structure

Not Ideal For

  • Salesforce projects with only simple automation and minimal custom Apex logic
  • Teams unfamiliar with enterprise patterns or layered architecture
  • Organizations with strict policies against third-party Apex libraries
  • Rapid prototyping scenarios where architectural overhead is undesirable

Pros & Cons

Pros

Proven Enterprise Patterns

Implements Service, Domain, Selector, and Unit of Work layers specifically adapted for Salesforce, ensuring clear separation of concerns as outlined in the documentation.

Efficient Governor Limit Management

The Unit of Work class optimizes DML operations, and Selectors centralize SOQL queries with security stripping, reducing governor limit consumption.

Integrated Security Enforcement

Supports native USER_MODE and SYSTEM_MODE for CRUD/FLS and sharing, with recent updates providing performance benefits and clearer intent over sharing declarations.

Enhanced Testability

Dependency injection via Application Factory and integration with ApexMocks allows for comprehensive unit testing and mocking of business logic layers.

Cons

Breaking Changes History

Significant updates like the April 2021 domain split and December 2022 deprecations require code migrations, as highlighted in the README's 'IMPORTANT CHANGE' sections.

Complex Initial Setup

Requires deploying the ApexMocks dependency first and a deep understanding of the patterns, which can slow down project kickoffs.

Fragmented Documentation

Core guidance is spread across external blog posts and articles, rather than a centralized, up-to-date documentation site.

Frequently Asked Questions

Quick Stats

Stars1,003
Forks569
Contributors0
Open Issues21
Last commit2 days ago
CreatedSince 2013

Tags

#service-layer#salesforce#domain-driven-design#apex#unit-of-work#enterprise-patterns#force-com#testing

Built With

S
Salesforce Platform
A
Apex

Included in

Salesforce782
Auto-fetched 1 day ago

Related Projects

Apex mocksApex mocks

An Apex mocking framework for true unit testing in Salesforce, with Stub API support

Stars459
Forks235
Last commit2 days ago
Force DIForce DI

Generic DI library with support for Apex, Triggers, Visualforce and Lightning

Stars240
Forks100
Last commit8 days ago
Apex Commons Sample CodeApex Commons Sample Code

Samples application illustrating the Apex Enterprise Patterns library

Stars217
Forks107
Last commit2 days ago
Apex Test KitApex Test Kit

A way to simplify your Salesforce data creation and method stubbing.

Stars162
Forks25
Last commit3 years ago
Community-curated · Updated weekly · 100% open source

Found a gem we're missing?

Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.

Submit a projectStar on GitHub