> ## Documentation Index
> Fetch the complete documentation index at: https://docs.activeviam.com/llms.txt
> Use this file to discover all available pages before exploring further.

# How to configure cubes

> How to configure cubes with the Atoti Configuration API, covering the `IModelConfigurer` Spring bean, the `ICubeManagerConfigurator.addCube()` and `cube()` methods, and `ICubeConfigurator`.

Cube configuration defines the analytical model that users query. This includes dimensions, hierarchies, levels, and measures, configured using the `IModelConfigurer` interface.

## Prerequisites

Before configuring cubes, make sure:

* The database is configured (see [configure the database](./../database))
* Basic Atoti concepts are understood (cubes, dimensions, hierarchies, measures)

## What is the IModelConfigurer interface?

Configuration is handled through a Spring bean that implements the `IModelConfigurer` interface.

The `configureCubes()` method receives an `ICubeManagerConfigurator` that defines cubes, dimensions, and measures. See the Javadoc for the complete list of available methods.

```java theme={"languages":{"custom":["/engine/python-sdk/6.2/languages/pycon.tmLanguage.json"]}}
public interface IModelConfigurer {
  /**
   * Configures the database using the provided object.
   *
   * @param database the object used to configure the database
   */
  void configureDatabase(IDatabaseConfigurator database);
  /**
   * Configures the cubes using the provided object.
   *
   * @apiNote This method is called after {@link #configureDatabase(IDatabaseConfigurator)}
   * @param cubeManager the object used to configure the cubes
   * @param schema the schema of its underlying database
   */
  void configureCubes(ICubeManagerConfigurator cubeManager, IDatabaseSchema schema);
}
```

## How to create a cube

Use `ICubeManagerConfigurator.addCube()` to create a cube. Specify the cube name and the fact table. The method returns an `ICubeConfigurator` for configuring dimensions and measures.

```java theme={"languages":{"custom":["/engine/python-sdk/6.2/languages/pycon.tmLanguage.json"]}}
ICubeConfigurator cubeConfigurator = managerConfigurator.addCube("cubeName", "factTableName");
```

## How to access an existing cube

Use `ICubeManagerConfigurator.cube()` to get the configurator for an existing cube. This is useful when modifying cubes from a predefined configuration.

```java theme={"languages":{"custom":["/engine/python-sdk/6.2/languages/pycon.tmLanguage.json"]}}
ICubeConfigurator cubeConfigurator = managerConfigurator.cube("cubeName");
```

## Related pages

* [Create dimensions and hierarchies](./structure): dimension types, hierarchy definitions, and relationship types
* [Create measures](./measures): measure definitions, aggregations, and measure factories
