# Builder

Builder is a lightweight IDE that is part of the Mprove UI.

You can create complete semantic models in the web UI, but we recommend working with Malloy files in your local IDE using the Malloy VS Code extension. 
You can then sync the files with the Mprove Server to check for errors and explore Mprove models.

## Mprove Files

Mprove project supports the following file types::

- [mprove.yml](/content/docs/reference/project-config) (Project Config)
- [\*.malloy](/content/docs/reference/model-malloy)
- [\*.store](/content/docs/reference/model-store)
- [\*.chart](/content/docs/reference/chart)
- [\*.report](/content/docs/reference/report)
- [\*.dashboard](/content/docs/reference/dashboard)
- [\*.schema](/content/docs/reference/dwh-schema)

## Version Control

Mprove treats the files in the project repository as the single source of truth.

Drafts are stored in the database. Once satisfied with a draft, the user can save it as a file for future use.

When a user saves a draft as a file in the Production repository, the change is committed automatically.

When a user saves a draft as a file in their Dev repository, the change remains uncommitted.

## Project Repositories

Each project has 3 types of repositories that are local to mprove server:

- **Production** - repository that mirrors **Remote** repository content
- **Dev** - personal repository for each project member with **FilesEditor** role
- **Session** - separate repository for each session of type Editor

Dev repositories allow users to edit files and test changes without affecting **Production** version of files.

Users with **FilesEditor** role can manually edit files in their personal Dev repositories.

<Callout type="info">
  To be able to edit files, a user with the **FilesEditor** role must select the
  **Dev** repository in the navigation bar.
</Callout>

## Files Validation

When user makes a manual change to any file, Mprove does the following:

- Validates all files
- Shows validation errors (if any)
- Updates Models, Charts, Dashboards and Reports structure that have passed validation

Once the user is satisfied with the changes made, the user can **_commit_** and **_push (deploy)_** changes to **Production** repository to share results with the team.

<Callout type="info">
  When changes are pushed to **Production**, they are actually pushed to
  **Remote** first, and then pulled from **Remote** to **Production**. In other
  words, changes from the **Dev** repository are pushed to the **Production**
  repository via the **Remote** repository in a single user action.
</Callout>

## File and git-related operations

These operations are available on the Files page:

- **Save and Validate** - Save the changes. Mprove will automatically check all files in the project repository data folder for errors.

<Callout type="warn">
  If errors are found during files validation step, they need to be fixed before pushing to production.
</Callout>

- **Commit** - Commit changes in Dev repo.
- **Push** - Deploy committed changes from Dev repo to Production repo (and to Remote repo).
- **Revert to Last Commit** - Discard saved changes in Dev repo that were not committed.
- **Revert to Production** - Revert all changes in the Dev repo to the current Production version of files.
- **Pull from Remote** - Fetch changes from Remote repo branch and merge into the selected repo branch.
- **Merge branch** - Merge changes from another branch into the current branch.
- **Create branch** - Create a new branch.
- **Delete branch** - Delete current branch.

## Git Branches

Small projects may only need to use one branch (usually called master or main). Advanced git users may work in different branches.

<Callout type="info">
  Users can switch between branches using **repo-branch** selector in navigation bar.
</Callout>
