Need help with fflib-apex-common?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

609 Stars 394 Forks BSD 3-Clause "New" or "Revised" License 401 Commits 83 Opened issues


Common Apex Library supporting Apex Enterprise Patterns and much more!

Services available


Need anything else?

Contributors list

FFLib Apex Common

Push Source and Run Apex Tests

Dependencies: Must deploy ApexMocks before deploying this library

Deploy to Salesforce


  • April 2020, IMPORTANT CHANGE, the directory format of this project repo was converted to Salesforce DX Source Format. While the GIT commit history was maintained, it is not visible on GitHub. If you need to see the history, either clone the repo and execute
    git log --follow
    from the command line or refer to this tag of the codebase prior to conversion.
  • September 2014, IMPORTANT CHANGE, changes applied to support Dreamforce 2014 advanced presentation, library now provides Application factories for major layers and support for ApexMocks. More details to follow! As a result ApexMocks must be deployed to the org before deploying this library. The sample application here has also been updated to demonstrate the new features!
  • July 2014, IMPORTANT CHANGE, prior 23rd July 2014, both the
    fflib_SObjectDomain.onValidate(Map existingRecords)
    methods where called during an on after update trigger event. From this point on the
    method will only be called during on after insert. If you still require the orignal behaviour add the line
    into your constructor.
  • June 2014, New classes providing utilities to support security and dynamic queries, in addition to improvements to existing Apex Enterprise Pattern base classes. Read more here.
  • June 2014, Experimental branch supporting automated FLS checking, see README for more details.

This Library

Is derived from the Dreamforce 2012 presentation on Apex Enterprise Patterns and progresses the patterns further with a more general ongoing home for them. It also adds some form of namespace qualification from the previous version. So that classes are grouped together more easily in the IDE's and packages. Below you can find comprehensive articles and videos on the use of these patterns. There is also a working sample application illustrating the patterns here.

Alt text

Application Enterprise Patterns on

Design patterns are an invaluable tool for developers and architects looking to build enterprise solutions. Here are presented some tried and tested enterprise application engineering patterns that have been used in other platforms and languages. We will discuss and illustrate how patterns such as Data Mapper, Service Layer, Unit of Work and of course Model View Controller can be applied to Applying these patterns can help manage governed resources (such as DML) better, encourage better separation-of-concerns in your logic and enforce coding best practices.

Dreamforce Session and Slides

  • View slides for the Dreamforce 2013 session here
  • Video recording of the Dreamforce 2013 session here.
  • Video recording of the Advanced Apex Enterprise Dreamforce 2014 session here.
  • View slides for the Dreamforce 2015 session here


Other Related Blogs

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.