# Starting applications

You start every application of a project with ap run-local in the root of its repository, and the command works the same locally on your machine and in the remote workspace.

> Source: https://www.application-platform.com/en/docs/workspace-ubuntu-dev-scripts/

You start every repository with the same command in its folder:

```bash
ap run-local
```

The `ap` CLI loads the [environment files]({{< relref "environment-setup" >}}) from `env/`, starts the services, and then the development server; the command behaves the same locally and in the [remote workspace]({{< relref "workspaces-overview" >}}), and the start button of the platform extension in VS Code, Cursor, and Antigravity runs it in a terminal.

## Backend, app, and homepage

A backend needs Docker running: `ap run-local` uses Docker Compose to start the database, Mailhog for caught emails, and PHPMyAdmin, then the development server of NestJS, FastAPI, or Laravel. An app starts as Flutter web or with the development server of its stack such as Next.js or Expo, with the generated and custom environment files in the build (for Flutter via `--dart-define-from-file`); you specify target and device like this:

```bash
ap run-local chrome            # web build in the browser
ap run-local ios-simulator     # iOS simulator, macOS only
ap devices list                # show available devices
```

A homepage starts Hugo or Astro on the port of the repository. The runtimes come from `.tool-versions`, via `asdf` on macOS and Linux and via FVM, NVM, and HVM on Windows; `ap bootstrap` installs them without starting the application, and `ap doctor` checks whether all tools are present.

## Ports

Every repository has fixed local ports from the platform, so backend, app, and homepage run in parallel:

```bash
ap ports
```

The command shows which port belongs to which repository.

## Stopping

The development server runs in the terminal until you stop it with Ctrl+C; the Docker containers of a backend can keep running, and you see and stop them in Docker Desktop or with `docker ps`.

## When something does not start

If `ap doctor` reports a missing tool, install it through the developer setup of the [setup app]({{< relref "local-app" >}}); in the workspace, the tools are preinstalled. If a port is taken, an earlier instance of the same application or an old container is usually still running, so stop it; `ap ports` tells you which port is meant. If a backend fails on its services, Docker is usually not running; start Docker Desktop and repeat the command. Add your own variables to `env/local.custom.env` and restart; the platform overwrites the generated files in `env/`.

