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

# Local development with Git sync

> Clone your synced Base44 app, run it locally, and keep your local changes and Base44 in sync.

After you connect your app to [GitHub](https://docs.base44.com/developers/app-code/local-development/github.md) or [GitLab](https://docs.base44.com/developers/app-code/local-development/gitlab.md), you can clone its repository and edit the code in your own tools. Base44 keeps your app and the repository in sync in both directions.

## Set up your local environment

Set up your local repository to start editing code in your preferred development environment.

**To set up your local repository:**

1. Clone the repository using the project's Git URL.
2. Navigate to the project directory.
3. Install dependencies: `npm install`.
4. Install the Base44 CLI: `npm install -g base44@latest`.
5. Authenticate: [`base44 login`](https://docs.base44.com/developers/references/cli/commands/login).
6. Link the clone to its app: [`base44 link`](https://docs.base44.com/developers/references/cli/commands/link). The `base44/.app.jsonc` link pointer is gitignored, so every fresh clone needs this step.

**Run the app locally:**

```bash theme={null}
base44 dev
```

This starts a local Base44 backend and your frontend dev server together. The frontend's `/api` requests are proxied to the local backend. See [Local development](https://docs.base44.com/developers/backend/overview/local-dev/local-development-overview.md) for what runs locally.

To work on only the frontend against your app's live hosted backend, run `base44 dev --remote` instead.

> [!WARNING]
>
> In remote mode, writes go to your live app's production data.

For details on the exported file structure, see [Project Structure](https://docs.base44.com/developers/app-code/overview/project-structure.md).

## Sync local changes to Base44

To sync your local changes to Base44, merge the changes to the main git branch. This branch must be named `main`. Other default branch names, such as `master`, currently aren't supported. Base44 pulls the merged changes so that they appear in your app whenever you open or are in the app editor.

After syncing, click **Publish** in the top right corner of your Base44 app to make the changes live for users.

### Deploy backend features

Merging to `main` syncs your code to Base44, but it doesn't deploy every backend resource. This table describes the behavior and required steps to deploy each resource after your project syncs:

| Resource | After merge | Publish required |
| - | - | - |
| Backend functions | Base44 deploys the changed functions to preview. | Yes. Publishing deploys them to production. |
| Entities | Base44 updates the schema in preview and production. | No. |
| Agents | Base44 updates the agents in preview and production. | No. |

> [!WARNING]
>
> Base44 syncs from your remote repository. Avoid deploying backend features with CLI deploy commands, such as [`base44 deploy`](https://docs.base44.com/developers/references/cli/commands/deploy), [`base44 functions deploy`](https://docs.base44.com/developers/references/cli/commands/functions-deploy), [`base44 entities push`](https://docs.base44.com/developers/references/cli/commands/entities-push), and [`base44 agents push`](https://docs.base44.com/developers/references/cli/commands/agents-push). These commands register your backend features with Base44 directly and bypass the remote repository. The next time Base44 syncs from the repository, it overwrites any changes the repository doesn't contain, including anything you deployed with CLI commands. To make sure your backend features sync correctly, merge your changes to `main` instead, and use `base44 dev` to test locally.

## Sync remote changes locally

When you make changes in the Base44 app editor or restore an earlier version from Version History, Base44 pushes a new commit to `main`. Your local clone doesn't receive these commits automatically, so it can fall behind the repository.

Pull `main` into your local clone before you push again. Git rejects a push from a local project that doesn't have the commits Base44 added.

### Resolve merge conflicts

A merge conflict occurs when a commit in your repository and a change in Base44 edit the same lines of a file. Base44 can't handle merge conflicts automatically. Instead, the AI chat lists the conflicting files and prompts you to click **Resolve Conflicts with AI**, which uses credits.


## Related topics

- [GitLab Integration](https://docs.base44.com/developers/app-code/local-development/gitlab.md)
- [GitHub Integration](https://docs.base44.com/developers/app-code/local-development/github.md)
- [Base44 developer tools](https://docs.base44.com/documentation/building-your-app/developer-tools.md)
- [Base44 Developer Platform](https://docs.base44.com/developers/home.md)
- [Getting to know the app editor](https://docs.base44.com/Getting-Started/app-editor-overview.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.