# Launching your app

> Opens your app in a browser, running on the local platform. It compiles the current source first, so what opens reflects what is on disk, then opens the app's local URL.

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

## Summary        {#summary}

Opens your app in a browser, served by the local platform ([Running a local platform](https://osysharp.com/reference/local/running-a-local-platform/)). It compiles the source
on your disk into the app first — so what you see is what you just wrote — and then opens the app's local address. Your
app serves its own login and access rules exactly as in production; this only opens the page.

## Signature      {#signature}

```console
osy launch [path] [--page <route>] [--print-url] [--no-compile] [--dev] [--as <login>]
```

## Description    {#description}

`osy launch` finds the local platform for your project, ensures your app exists there, compiles the current source into
it, and opens `http://<your-app>.localhost:<port>/` in your browser. Edit, `osy launch`, see the result. If no platform
is running for the project, it **starts one for you** in the background first, so a single command takes you from source
to an open page ([Running a local platform](https://osysharp.com/reference/local/running-a-local-platform/); [Stopping the local platform](https://osysharp.com/reference/local/stopping-the-local-platform/) shuts it down).

- `--print-url` prints the app's URL and opens nothing — for an editor that wants to open the page its own way. In this
  mode the URL is the only thing written to standard output.
- `--page <route>` opens the app at one of its pages instead of its front page: `osy launch --page /books`. The route
  is the page's own address and starts with a slash. It is refused together with `--dev` or `--as`, which each open an
  address of their own.
- `--no-compile` opens the app as it was last compiled, without recompiling first — a quick re-open.
- `--dev` opens the app's dev page instead of the app ([Dev seeds: a fixture you can load into the running app](https://osysharp.com/reference/testing/dev-seeds/)).
- `--as <login>` opens the app **signed in** as one of its own accounts, with no password and no login page. See
  below.

### Opening it signed in — `--as`   {#as}

`osy launch --as ada@example.com` opens the app as that account. The address that opens is a **link that works once**:
the tab that opens it is signed in as the account, and the same link opened again — in another tab, from your
history, by anyone it was pasted to — opens a page saying the link is spent. It also expires five minutes after it is
made.

- It is for the local platform only, and it is yours to make because the platform is running on your computer. A
  deployed app has no such link.
- The account must exist. Add one with [Adding an account](https://osysharp.com/reference/local/adding-an-account/), or load a seed that makes some
  ([Dev seeds: a fixture you can load into the running app](https://osysharp.com/reference/testing/dev-seeds/)). A login the app does not hold is refused, and the answer lists the ones it does.
- It skips the login page, never the rules: the tab is that account, so its roles and your `security { }` blocks decide
  what it sees.
- The session belongs to the one tab. A second tab on the same address is signed out; run the command again for
  another.
- With `--print-url` the one-time address is printed instead of opened.

A brand-new app has no page yet, so its address returns "not found" until you add one — the app is there; it just has
nothing to show at `/`.

If the browser runtime your pages are drawn with is not being served, `launch` says so **before** it opens anything,
and names the command that builds it. Pages are drawn in the browser, so without it the address answers perfectly well
and shows a blank screen — the one failure that looks exactly like a bug in the app you just wrote.

## Examples       {#examples}

```console
osy launch                 # starts the platform if needed, compiles, opens in the browser
osy launch --print-url     # just print http://<app>.localhost:<port>/
osy launch --page /books   # open it at one of its pages
osy launch --as ada@example.com   # open it signed in as that account, once, in one tab
```

## See also       {#see-also}

[Launching the page you're on](https://osysharp.com/reference/local/launching-the-page-youre-on/) — press F5 in your editor and land on the page you are editing, not on `/`.

[Running a local platform](https://osysharp.com/reference/local/running-a-local-platform/) — the local platform your app runs on, and how to start it.

[Running tests locally](https://osysharp.com/reference/testing/running-tests-locally/) — run your app's tests against the same local platform.
