# Studio Bootstrap

## What It Does

Bootstrap prepares the initial studio session. It resolves the target world, loads world metadata, bookmarks, and the first chunk neighborhood, then composes the initial editable document shown in the studio window.

## Key Files

- `src/worldshaperStudio/bootstrap.ts`
- `src/worldshaperStudio/main.ts`
- `src/worldshaperStudio/runtime.ts`

## Endpoints It Uses

- `GET /api/world-default`
- `GET /api/world/:worldId`
- `GET /api/world/:worldId/bookmarks`
- `GET /api/world/:worldId/chunks`

## Important State

- current world id and world metadata
- chunk width and height
- source chunk list
- bookmark-derived initial camera position
- initial composed document layers and height layers

## Invariants And Constraints

- World mode starts from a chunk neighborhood, not a full-world payload.
- Bookmarks can influence the initial view center.
- Bootstrap has to hydrate enough content catalogs for tiles and sprites to render correctly.

## Common Request Themes

- startup performance
- opening the wrong world or stale world state
- incorrect first camera position
- missing tiles or sprites on first load

## Triage Questions

- Is the problem visible only at startup?
- Does the issue disappear after movement or reload?
- Is it a missing bootstrap dependency, or a later runtime bug?
