# Keeping your project in sync

Learn when and how to synchronize types and content in your project.

The CLI manages two things in your project: **type definitions** and [fallback content](/explanation/content/fallback-content). Both need to stay in sync with your workspace so that your code reflects the latest schemas and your application always has content to render.

This guide shows which command to run for each common scenario.

## Quick reference

If you already know what changed and just need the right command, use this summary as a quick lookup:

| Command                                                  | What it does                                                                         |
| -------------------------------------------------------- | ------------------------------------------------------------------------------------ |
| [`install`](/reference/cli/commands/install)             | Generates all types and downloads all content from your workspace.                   |
| [`update`](/reference/cli/commands/update)               | Pulls the latest schemas and content from your workspace, keeping the same versions. |
| [`upgrade`](/reference/cli/commands/upgrade)             | Adopts newer major versions, then regenerates types and content.                     |
| [`add slot`](/reference/cli/commands/add-slot)           | Adds a new slot to your project, generates its types, and downloads its content.     |
| [`add component`](/reference/cli/commands/add-component) | Adds a new component to your project and generates its types.                        |

## What the CLI manages

The CLI keeps two categories of generated artifacts in your project. Understanding what they are helps you know why syncing matters.

**Type definitions** are generated from your slot and component schemas. They give your editor autocomplete and type checking when working with content. For a deeper look at how this works, see [Type generation](/reference/cli/type-generation).

**Fallback content** is the default content downloaded for each slot, version, and locale. The SDK uses it as an automatic fallback so your application always renders meaningful content, even during network failures. For more details, see [Fallback content](/reference/cli/fallback-content).

## Automatic synchronization

Depending on the SDK, the [`install`](/reference/cli/commands/install) command can register a hook that runs automatically when you install dependencies. When this hook is set up, installing dependencies also runs `croct install` behind the scenes, keeping types and content in sync automatically.

In most cases, this means things stay up to date without any extra effort. The scenarios below cover what to do when you need to sync manually.

## Syncing at your own pace

Changes you make in the admin panel never break your project. Schemas are versioned, so your code continues to work with the version it was built against until you explicitly update or upgrade. You can sync whenever it fits your workflow.

The admin panel also helps you stay aware: whenever you make a change that requires syncing, it prompts you with the appropriate command.

> **Run from the browser**
>
> With [deep links](/reference/cli/deep-links) enabled, you can trigger CLI commands directly from the browser by clicking the run buttons in the admin panel or documentation.

## Common scenarios

Here are the most frequent situations where you may need to sync your project manually, along with the right command for each one.

### Cloning or reinstalling

After cloning a repository or running a fresh dependency install, you need to generate types and download content. If the automatic hook is set up, this happens automatically. Otherwise, regenerate everything from your [configuration file](/reference/cli/configuration) by running:

```sh
croct install
```

### Adding a new slot

To start using a slot that exists in your workspace but is not yet in your project, add it to the [configuration file](/reference/cli/configuration) along with its types and default content by running:

```sh
croct add slot
```

### Adding a new component

To add a component to your project along with its type definitions, run:

```sh
croct add component
```

### Updating fallback content

After changing a slot's default content in the admin, your local [fallback content](/explanation/content/fallback-content) is outdated. To pull the latest content and regenerate type definitions, run:

```sh
croct update
```

### Changing a schema

When you modify a schema in the admin (for example, adding a new field to a slot or updating a component structure), your local types no longer match. To regenerate types and re-download content, run:

```sh
croct update
```

### Upgrading to a new version

When a new major version is published and you want to adopt it, update the version specifiers in the [configuration file](/reference/cli/configuration) and regenerate types and content by running:

```sh
croct upgrade
```

After upgrading, remember to update any version references in your code, such as slot identifiers in fetch calls (e.g., `home-hero@1` to `home-hero@2`).

## Explore

Check out these links to learn more:

- [Type generation](/reference/cli/type-generation): Learn how the CLI generates type definitions for your project.
- [Fallback content](/reference/cli/fallback-content): Learn how the CLI manages fallback content for your project.
- [Command reference](/reference/cli/commands): Browse the full list of CLI commands.
