# Defold HTML5 game hosting

Host your Defold HTML5 bundle with HTTPS and your own domain. Deploy the folder containing index.html, and upload only changed files on the next release.

On the web at https://lobsite.com/hosting/defold

```sh
npx lobsite ./build/web
```

Bundle for HTML5, put the playable folder at build/web, then run this from your project folder.

Your Defold HTML5 bundle can run directly at its own web address. Publish the folder containing its HTML entry point, scripts, runtime and game resources. Lobsite serves the bundle over HTTPS, and the next deployment uploads only the files that changed.

## How it works

1. **Create an HTML5 bundle.** In Defold, choose Project → Bundle → HTML5 Application. Make a release bundle and find the generated folder containing `index.html`.
2. **Publish that folder.** For a non-threaded bundle, drop it or its ZIP above. If you place the playable files in `build/web`, run `npx lobsite ./build/web` from your project directory. Threaded bundles need the CLI settings below.
3. **Keep the game and iterate.** The first anonymous link lasts 6 hours. Claim it to keep its address, then bundle and deploy again when the game changes.

## Find the playable folder inside the bundle

The output location you choose in Defold can contain a generated application folder. Deploy the folder that actually contains `index.html`, rather than an outer folder with the game nested one level down. Keep the generated resource directories together.

Defold's web runtime uses Emscripten. Leave the bundle's generated runtime and loader files intact; uploading only the game resources isn't enough. The [Defold HTML5 manual](https://defold.com/manuals/html5/) covers engine settings and browser-specific behaviour.

## Threaded Defold bundles

The regular `wasm-web` engine doesn't need isolation headers. A bundle using only `wasm_pthread-web` needs them; including both architectures lets Defold fall back to the non-threaded engine when isolation isn't available.

For threads, save this in `lobsite.toml` at the project root and run `npx lobsite` there:

```toml
dir = "build/web"

[[headers]]
for = "/*"
[headers.values]
Cross-Origin-Opener-Policy = "same-origin"
Cross-Origin-Embedder-Policy = "require-corp"
```

The browser drop box doesn't read this file. External resources must allow loading under cross-origin isolation too.

## Measure the engine and game resources

An HTML5 bundle includes runtime files as well as your own game. Free and anonymous hosting allow 5 MB per file, 50 MB total and 100 files. Check the largest generated file rather than estimating from the size of your source project.

Standard allows 100 MB per file, 2 GB total and 10,000 files. If a generated resource file is over the limit, reduce or restructure the bundle before deploying. The browser box above accepts up to 25 MB per upload; larger bundles use the CLI or signed-in dashboard. See [HTML5 game limits](https://lobsite.com/hosting/html5-games#limits).

## Input, sound and live resources

Test the hosted build with keyboard, pointer and touch input as appropriate. Browser audio needs a player interaction before it can start. Set a viewport and scaling behaviour suited to the screens you support.

If you use Defold Live Update or another external resource service, check its URLs, HTTPS and cross-origin permissions at the deployed address. Lobsite serves the files you upload and doesn't generate additional resource archives for you. A `npx lobsite --preview` deployment gives a new bundle its own testing URL while leaving the live release alone.

## Defold build and sharing choices

| Choice | What it does | Useful for |
|---|---|---|
| HTML5 bundle on Lobsite | Serves the game at an HTTPS URL | Players on compatible browsers |
| A local browser test | Runs a web bundle on your machine | Diagnosing browser behaviour before deployment |
| A native bundle | Produces a platform-specific application | Native releases rather than browser play |

Compare [Phaser hosting](https://lobsite.com/hosting/phaser) for a JavaScript workflow or [Godot hosting](https://lobsite.com/hosting/godot) for another web export. The [HTML5 overview](https://lobsite.com/hosting/html5-games) explains shared hosting considerations.

## Frequently asked questions

### Which folder from my Defold bundle should I deploy?

Deploy the folder with `index.html` directly inside it and keep its scripts, runtime and resource directories together. Don't deploy an outer folder that hides the entry point below another directory.

### Does every Defold HTML5 bundle fit Free?

No. Runtime size, game resources and file count all matter. Check the finished bundle against the 5 MB per-file, 50 MB total and 100-file limits.

### Does Lobsite build a Defold project from game.project?

No. Bundle it for HTML5 in Defold first. Lobsite publishes the resulting files rather than running the editor or build tools.

### Can Defold Live Update fetch resources from another host?

Yes, if that host and your game's configuration allow the browser requests. Use HTTPS and check cross-origin permissions; deploying the initial bundle doesn't set up that service.

