# Build Guide

This guide covers the source bundle exactly as it appears in the downloadable archive.

## What can be built from this pack

The build-ready package in this release is the Flutter client under `client_app/`.

The server reference under `backend_reference/` is included alongside it so the messaging flow can be reviewed from source.

## Platform service config note

The Android and iOS mobile service configuration files included here use placeholder values.

## Flutter client setup

1. Open `client_app/`.
2. Run `flutter pub get`.
3. Run `flutter analyze`.
4. Start a target with the runtime flags that fit the environment being used.

## Android emulator example

```bash
flutter run \
  --dart-define=USE_LOCAL_BACKEND=true \
  --dart-define=LOCAL_BACKEND_HOST=10.0.2.2:8000 \
  --dart-define=APP_DISTRIBUTION=website
```

## Custom backend host example

```bash
flutter run \
  --dart-define=USE_LOCAL_BACKEND=true \
  --dart-define=LOCAL_BACKEND_BASE_URL=http://192.168.1.20:8000 \
  --dart-define=LOCAL_BACKEND_WS_URL=ws://192.168.1.20:8000 \
  --dart-define=APP_DISTRIBUTION=website
```

## Runtime flags used by the client

- `USE_LOCAL_BACKEND`
  - switches the app to locally provided API and websocket endpoints
- `LOCAL_BACKEND_HOST`
  - convenient host-and-port form for emulator runs
- `LOCAL_BACKEND_BASE_URL`
  - explicit HTTP base URL override
- `LOCAL_BACKEND_WS_URL`
  - explicit websocket base URL override
- `APP_DISTRIBUTION`
  - chooses the runtime profile used by the app

## Helpful first files after setup

- `client_app/lib/main.dart`
- `client_app/lib/utils/app_config.dart`
- `client_app/lib/services/api_service.dart`
- `client_app/lib/services/hash_service.dart`
- `client_app/lib/services/key_service.dart`
- `backend_reference/app/routers/prekeys.py`
- `backend_reference/app/models/message.py`
