index.json
index.json is the entry point of your repository. The platform reads this file first and uses it to discover all the classes in your project.
Location
index.json must be in the root of the repository.
Structure
{
"$schema": "https://api.mosterd.com/schema/definition-v1.schema.json",
"version": 1,
"class": "my-project.index",
"kind": "CONFIG",
"imports": [
"my-project.employee",
"my-project.company",
"my-project.employmentAgreement"
]
}
| Property | Type | Description |
|---|---|---|
version | integer | The definition format of this file. Like every class file, index.json declares its own version. |
class | QualifiedName | The identifier of this index. Convention: {namespace}.index. |
kind | CONFIG | Always CONFIG for index files: the index configures the model and has no objects of its own. |
imports | QualifiedName[] | List of classes to load. Each qualified name maps to a JSON file in the repository. |
Imports
Each entry in imports is a qualified name. The platform resolves it to a JSON file using the class name:
my-project.employee→employee.jsonmy-project.employmentAgreement→employmentAgreement.json
Files are resolved relative to the directory of index.json: the repository root, or the directory configured for the tenant.
You can also import commons classes to make them explicitly available, though built-in commons classes are always available regardless.
Minimal example
{
"version": 1,
"class": "my-project.index",
"kind": "CONFIG",
"imports": [
"my-project.person",
"my-project.company"
]
}
With this index.json and two files person.json and company.json in the root, the platform loads two custom classes.
Modules
Beyond imports, index.json is also where you declare optional class bundles called modules. Modules let different tenants activate different subsets of your data model.
See Modules for the full explanation.