# Compiling your app

> Compiles your app's source into the app on the local platform — the inner-loop compile-and-apply. It applies additive changes directly; non-additive ones (drops, renames, type changes) are gated behind a migration.

<!-- id: local-compiling-your-app · area: local · stability: stable · html: https://osysharp.com/reference/local/compiling-your-app/ -->

## Summary        {#summary}

Compiles the source on your disk into your app on the local platform ([Running a local platform](https://osysharp.com/reference/local/running-a-local-platform/)) — the
inner-loop compile-and-apply. Additive changes (new entities, fields, functions) apply directly; changes that would
remove or reshape existing data are held until you authorise them with a migration.

## Signature      {#signature}

```console
osy compile [path] [--prune] [--generate-migration] [--migration <file>] [--json]
```

## Description    {#description}

`osy compile` finds the local platform for your project, ensures your app exists there, and compiles the current source
into it. It needs no account and no credentials — the local platform is yours. If no platform is running for the
project, it **starts one for you** in the background and leaves it running, so you never have to start a server first —
the compile is a single command. (See [Running a local platform](https://osysharp.com/reference/local/running-a-local-platform/), and [Stopping the local platform](https://osysharp.com/reference/local/stopping-the-local-platform/) to
shut it down.)

- `--prune` reconciles the app to the source, dropping metadata the source no longer declares. On a local (Development)
  app these apply; removing something in production requires a migration.
- `--generate-migration` writes a migration template listing any non-additive changes, each marked `acknowledged =
  false` for you to review — it does not apply anything.
- `--migration <file>` applies a migration you have reviewed and authorised.
- `--json` writes the compile result as JSON.

Compiling against a remote platform is the operator command `osyrin app compile` — the same compile, a different
target.

## Examples       {#examples}

```console
osy compile                       # starts the local platform if needed, then applies the current source
osy compile --generate-migration  # preview a migration for any non-additive changes
```

## See also       {#see-also}

[Importing data](https://osysharp.com/reference/local/importing-data/) — load the app's rows, the other half of "copy this app and it works".

[Running a function](https://osysharp.com/reference/local/running-a-function/) — run one of the app's functions once it is compiled.

[Running a local platform](https://osysharp.com/reference/local/running-a-local-platform/) — the local platform your app compiles into.

[Launching your app](https://osysharp.com/reference/local/launching-your-app/) — open the app in a browser after compiling.

[Running tests locally](https://osysharp.com/reference/testing/running-tests-locally/) — run your app's tests (which compile the source too).
