# Firebase App Hosting

`--preset firebase-app-hosting` is chosen when `FIREBASE_APP_HOSTING` is set, or by name. The output is the `node` build, which serves its own public files, plus `.apphosting/bundle.yaml` in the project root:

## Reference

|                      |                        |
| -------------------- | ---------------------- |
| Preset               | `firebase-app-hosting` |
| Runs on              | Firebase App Hosting   |
| `event.runtime.name` | `node`                 |
| Server target        | `node`                 |
| Lifetime, startup    | `process`, `load`      |

### Output

```text
.apphosting/bundle.yaml     runCommand: node .output/server/index.mjs
.output/                     the node layout
```

### Config keys

| Key                   | Default | What it does                                                                                                                   |
| --------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------ |
| `firebase.appHosting` | `{}`    | merged into `runConfig` of `bundle.yaml` after `runCommand`: `cpu`, `memoryMiB`, `concurrency`, `maxInstances`, `minInstances` |

### Detection

The build selects it when `FIREBASE_APP_HOSTING` is set, unless `--preset`, `preset` or `HAMUR_PRESET` names another. It is a row of the one table of markers in [Choosing a preset](/deploy#choosing-a-preset).

### Deploy command

No `hamur deploy` command: it exits 1 for this preset. App Hosting builds and deploys from the repository. `hamur preview` runs the built output with Hamur's own runner.

### Limits

- Runs: streamed answers, private `app/env.ts` entries read at run time.
- Does not run: WebSockets and `server.syncedState`, `server.pubsub`, `server.metrics`, image transforms at run time, Durable Object classes.

The levels are the `features` of the preset: `hamur build` warns or fails when the app uses a feature the preset does not run (see [Preset features](/deploy#preset-features)).

```yaml
version: v1
runConfig:
  runCommand: node .output/server/index.mjs
outputFiles:
  serverApp:
    include:
      - .output
metadata:
  framework: hamur
  frameworkVersion: 0.0.1
  adapterPackageName: hamur
  adapterVersion: 0.0.1
```

`firebase.appHosting` is merged into `runConfig` after `runCommand`, for example `firebase: { appHosting: { cpu: 2, memoryMiB: 1024, maxInstances: 4 } }`. Another key under `firebase`, or a `runCommand`, fails the load.
