# ushort

`ushort` is a compact, self-contained URL shortener written in Rust and backed
by SQLite. It serves an embedded web interface and JSON API from a single
statically linked executable.

It supports deployment at either a dedicated host such as `s.example.com` or
under a path such as `example.com/s`. Images are available for Linux AMD64 and
ARM64.

## Quick start

Requirements: Docker with the Compose plugin.

```bash
cp config.example.toml config.toml
# Set a private api_key in config.toml.

mkdir -p data
USHORT_CONFIG="$PWD/config.toml" \
USHORT_DATA="$PWD/data" \
USHORT_UID="$(id -u)" \
USHORT_GID="$(id -g)" \
  docker compose -f deploy/docker-compose.prod.yml up -d
```

The example starts ushort at <http://localhost:18082/s/> and stores its SQLite
database in `./data/urlshort.db`.

Check it and stop it with:

```bash
curl http://localhost:18082/s/api/health
docker compose -f deploy/docker-compose.prod.yml down
```

This pulls the published image; it does not compile ushort or require a Rust
toolchain.

## Build from source instead

To build the current checkout locally, use the alternative build definition:

```bash
mkdir -p data
USHORT_UID="$(id -u)" USHORT_GID="$(id -g)" \
  docker compose -f deploy/docker-compose.build.yml up --build -d
```

It uses the same root-level `config.toml` and `data/` directory as the quick
start.

## Documentation

- [Configuration](docs/configuration.md)
- [API reference](docs/api.md)
- [Embedded frontend](docs/frontend.md)
- [Data and database compatibility](docs/data.md)
- [Production deployment and rollback](docs/deployment.md)
- [Development, testing, and releases](docs/development.md)
- [Security model](docs/security.md)
