---
url: https://apexfluently.beyondthecloud.dev/libraries/apex-consts.md
description: >-
  Structured approach for managing constants in Apex. On-demand loading, modular
  design, and English-like notation. No more God classes.
---

# Apex Consts

The Constants Framework provides a structured approach for managing constants in Apex.

## What Does It Solve?

* **Variables Scattered Across Codebase** - The same constant values duplicated in multiple places.
* **God Class** - A single massive class containing all constants becomes hard to maintain.
* **Code Performance** - Loading all constants at once, even when unnecessary, impacts Apex heap size.

## Why Apex Consts?

* **Request and Cache** - Only necessary consts are saved in Apex memory.
* **Consts Modules** - Separated const classes per sObjectType or business logic. No more God class.
* **Consts Entry Point** - Access all your consts via the `Consts` class.
* **English-like Notation** - Make your code clean with English-like notation: `Consts.ACCOUNT.TYPE.PROSPECT`.

## Quick Start

```apex
Account acc = new Account(
    Name = 'My Account',
    Type = Consts.ACCOUNT.TYPE.PROSPECT,
    Rating = Consts.ACCOUNT.RATING.HOT
);
```

## Documentation

* [Repository](https://github.com/beyond-the-cloud-dev/apex-consts)

## Installation

* [Copy and Deploy](https://github.com/beyond-the-cloud-dev/apex-consts/tree/main/force-app/main/default/classes)
