# DevSpaces

Run AppPortal DevSpace locally with Docker, connect your SDK, and explore development telemetry without a hosted workspace.

Source: https://appportal.io/docs/getting-started/devspaces

Run DevSpace in one Docker container and see your app's sessions, events, logs, HTTP requests,
and error reports locally. SQLite keeps the workspace between restarts. No hosted AppPortal
account or separate database is required.

## Start with Docker Hub

Install Docker Desktop (macOS or Windows), or Docker Engine with Compose (Linux).
Set `DEVSPACE_IMAGE` in a local `.env` file to your DevSpace Docker Hub image with the `latest` tag:

```dotenv
DEVSPACE_IMAGE=docker.io/<PUBLISHER>/<DEVSPACE_IMAGE>:latest
```

Replace the placeholders with the Docker Hub repository name. Download [compose.yaml](https://appportal.io/downloads/devspace/compose.yaml) into a new directory, then run:

```sh
docker compose -f compose.yaml config --quiet
docker compose -f compose.yaml pull
docker compose -f compose.yaml up -d
curl --fail http://localhost:8080/health
```

Open **http://localhost:8080**.

Already using port 8080? Put `DEVSPACE_PORT=8081` in a local `.env` beside the Compose file and
use that port in the URLs below. Keep an existing workspace and its volume intact.

## Create your application

Choose **Create application**, name your app and environment, and save the SDK key privately
when it appears. The complete key is shown once. Reuse this app and key for later runs.

Follow your [SDK's initialization guide](https://appportal.io/docs/sdks/compatibility), using the local app key and
DevSpace's **base URL**. For a .NET app, the endpoint selection looks like this:

```csharp
AppPortalSdk.CreateBuilder("<DEVSPACE_APP_KEY>")
    .WithEndpoint(new Uri("http://127.0.0.1:8080"))
    .Start();
```

Keep your platform's startup overload and consent flow; for example, Android uses its native
handle at startup. Keep the key in private build settings. Do not append `/v1/ingest` to the base
URL or place the key in a URL. The SDK sends `X-AppPortal-SDK-Key` on ingestion requests.


## Connect your runtime

| Runtime | Local endpoint |
| --- | --- |
| App running on the Mac | `http://127.0.0.1:8080` |
| iOS Simulator on the Mac | `http://127.0.0.1:8080` |
| Android emulator with ADB reverse | `http://127.0.0.1:8080` |
| Physical phone | A device-reachable HTTPS ingestion URL; the phone's localhost is the phone |

For Android, map only your chosen collector port to the selected emulator:

```sh
adb -s <EMULATOR_SERIAL> reverse tcp:8080 tcp:8080
# Remove your mapping when finished:
adb -s <EMULATOR_SERIAL> reverse --remove tcp:8080
```

Allow development HTTP only for loopback where your app platform requires it. Do not disable
certificate validation or broadly allow cleartext networking. For a phone, continue to
[physical-device networking and tunnels](https://appportal.io/docs/getting-started/devspaces-networking).

## Find your first session

Run the app with consent granted. Browse a screen, record a useful event and log, and report a
handled test exception. Exercise a real HTTP request if capture is configured. Open your app in
DevSpace, then **Sessions**, and select the new run. Follow its events, logs, timings, and error
reports. Correlate the new session rather than relying on old demonstration data.

Select a request to inspect its status and duration. Expand a log or handled error to see the
context recorded by your app. Keep the app, environment, and release in view as you move between
records.

[Session investigation](https://appportal.io/docs/guides/investigate-session) explains lifecycle and navigation context.

## Keep your workspace

The `devspace-data` volume contains `/data/devspace.db`, key hashes, quota state, and optional
AI configuration. Keep the same directory, Compose project, and volume on updates.

```sh
docker compose -f compose.yaml stop       # retain data
docker compose -f compose.yaml start      # resume
# Update the published image, retaining the same volume:
docker compose -f compose.yaml pull
docker compose -f compose.yaml up -d
```

`docker compose down` retains the named volume. Adding `--volumes` deletes it. Back up the complete
volume with the service stopped before changing stored data. To pin a particular image, set
`DEVSPACE_IMAGE=docker.io/<PUBLISHER>/<DEVSPACE_IMAGE>@sha256:<DIGEST>` in `.env`.
A digest identifies image content; `latest` is the published tag used by this guide.

## Web, MCP, and optional Ollama

The web UI is `http://localhost:8080`; read-only Streamable HTTP MCP is
`http://localhost:8080/mcp`. Use the connection dialog's configuration in your MCP client.
Both read the same local data and have no user login: keep them on loopback.

Telemetry works without AI. If Ollama is already running on the host with a downloaded model,
choose **Ollama → Docker host** in AI settings, discover a model, and save. Docker Desktop uses
`http://host.docker.internal:11434/`. Native Linux Docker Engine also needs
[compose.ollama-linux.yaml](https://appportal.io/downloads/devspace/compose.ollama-linux.yaml):

```sh
docker compose -f compose.yaml -f compose.ollama-linux.yaml up -d
```

Successful model discovery verifies connectivity. The mapping does not change Ollama's listener
or firewall; keep Ollama private.
See [Docker Desktop networking](https://docs.docker.com/desktop/features/networking/).

## Limits and troubleshooting

- Ten applications per instance and ten stable installation identities per application.
- 5,000 accepted messages across the instance in the **rolling trailing 24 hours**, with seven-day retention.
- Missing or invalid SDK keys return 401. A hosted credential cannot replace this local app's key.
- On 429, honor retry hints; do not clear the database or rotate installation IDs to bypass limits.
- No records? Check reachability from the app runtime, consent, endpoint, key, and local SDK diagnostics.
  Inspect `docker compose -f compose.yaml logs --tail 100` privately.

DevSpace intentionally omits hosted organization management, geography, and release workflows.
It does not forward collected telemetry to hosted AppPortal.
