---
title: "Initialize Shorebird"
description: "Learn how to add Code Push to an existing Flutter project."
---

Note

If you are starting a new project, you can use [`shorebird create`](/code-push/create) to generate a new Flutter app with Shorebird.

[Initializing Shorebird in an existing Flutter project](https://app.arcade.software/share/5w5LiD8ODdaGhb6554X9)

To configure an existing Flutter project to use Shorebird, use `shorebird init` at the root of a Flutter project:

```
shorebird init
```

This does three things:

1. Tells Shorebird to create a unique `app_id` for your app. This `app_id` is how Shorebird identifies your app and knows which updates to send to it. It does not need to be kept secret.
2. Creates a `shorebird.yaml` file in your project’s root directory. `shorebird.yaml` contains the `app_id` mentioned above.
3. Adds the `shorebird.yaml` to the assets section of your `pubspec.yaml` file, ensuring `shorebird.yaml` is bundled with your app’s assets and is available to the Shorebird updater at runtime.

You can safely commit these changes; they will have no effect on your app when not using Shorebird.

Example output for an app named `shorebird_test`:

```
$ shorebird init
✓ Detecting product flavors (0.6s)
? How should we refer to this app? (shorebird_test) shorebird_test
✓ Shorebird is up-to-date (0.6s)
✓ Flutter install is correct (4.5s)
✓ AndroidManifest.xml files contain INTERNET permission (23ms)

No issues detected!

🐦 Shorebird initialized successfully!

✅ A shorebird app has been created.
✅ A "shorebird.yaml" has been created.
✅ The "pubspec.yaml" has been updated to include "shorebird.yaml" as an asset.

Reference the following commands to get started:

📦 To create a new release use: "shorebird release".
🚀 To push an update use: "shorebird patch".
👀 To preview a release use: "shorebird preview".

For more information about Shorebird, visit https://shorebird.dev
```

Note

You can supply a display name directly via the command line by passing the `--display-name` flag:

```
shorebird init --display-name "My App"
```

Note

If your account belongs to multiple organizations, `shorebird init` will prompt you to choose one interactively. In non-interactive environments (e.g., CI), you can skip the prompt by passing `--organization-id`:

```
shorebird init --organization-id 42
```

Run `shorebird account orgs` to list your organization IDs.

The generated `shorebird.yaml` should look similar to:

```
# This file is used to configure the Shorebird updater used by your application.
# Learn more at https://shorebird.dev
# This file should be checked into version control.

# This is the unique identifier assigned to your app.
# It is used by your app to request the correct patches from Shorebird servers.
app_id: 8c846e87-1461-4b09-8708-170d78331aca
```

If your application contains flavors, `shorebird init` will create an app per flavor and `shorebird.yaml` will include all flavors and their corresponding `app_ids`:

```
# This file is used to configure the Shorebird updater used by your application.
# Learn more at https://shorebird.dev
# This file should be checked into version control.

# This is the unique identifier assigned to your app.
# It is used by your app to request the correct patches from Shorebird servers.
app_id: 864ab1b0-ba78-4b15-990a-a63cec35a41b
flavors:
  development: 864ab1b0-ba78-4b15-990a-a63cec35a41b
  production: 6b6e6631-4fbe-4645-8d9d-d5247656d975
```

Note

The `app_id` is a required field in every `shorebird.yaml`. In the case of flavors, `app_id` will default to the first flavor and will be overwritten at build time to the corresponding flavor’s `app_id`.

Disabling automatic updates

By default, Shorebird checks for and downloads patches automatically in the background at app launch. To disable this and control updates programmatically (e.g., show a prompt before updating), add `auto_update: false` to `shorebird.yaml`:

```
app_id: 8c846e87-1461-4b09-8708-170d78331aca
auto_update: false
```

You can then use [package:shorebird\_code\_push](https://pub.dev/packages/shorebird_code_push) to check for updates and trigger them at a time of your choosing. See [Update Strategies](/code-push/update-strategies) for examples.

Note

Shorebird Code Push requires the internet permission to be added to your `AndroidManifest.xml` file (located in `android/app/src/main/AndroidManifest.xml`). This is required for the app to be able to communicate with the Shorebird servers to download patches.

`shorebird init` will add this permission if it is not already present.

```
<manifest ...>
<uses-permission android:name="android.permission.INTERNET" />
...
</manifest>
```

Tip

If you already have a `shorebird.yaml` and would like to re-initialize your project, use `shorebird init --force`. This will overwrite your existing `shorebird.yaml` and create a new app/app\_id. Existing apps will not be affected by re-initializing Shorebird.

## What’s next

[Section titled “What’s next”](#whats-next)

[Create a Release](/code-push/release)Build and submit your app to Shorebird.

[Preview Locally](/code-push/preview)Test your release on a local device before publishing.
