# Run your first time series

This guide uses a **standalone development build** and the repository's sample configuration. You need Linux or macOS, Rust 1.94+, Cargo, curl, and an SMTS source checkout. [Request source access](mailto:info@simplemagic.com?subject=SMTS%20source%20access) if you do not have one.

## Start the server

From the SMTS checkout, with a fresh `./data` directory:

```sh
cargo build -p smts-server
cargo run -p smts-server -- --config config.toml
```

Leave this terminal running. Paths in the supplied configuration are relative to the working directory. It binds to `127.0.0.1:9070`; the standalone server is unauthenticated, so keep this evaluation on loopback.

In a second terminal, wait for HTTP 200:

```sh
curl --fail-with-body http://127.0.0.1:9070/readyz
```

## Write three measurements

Use `--data-binary` to preserve line breaks. Timestamps are **nanoseconds**, not milliseconds.

```sh
curl -i http://127.0.0.1:9070/write \
  -H 'Content-Type: text/plain; charset=utf-8' \
  --data-binary 'temperature,device=dev-001 value=21.5 1791504000000000000
temperature,device=dev-001 value=22.0 1791504001000000000
temperature,device=dev-002 value=19.0 1791504000000000000'
```

Expect HTTP **204** with no result body. The whole batch is validated, written to the WAL, synced, and applied before the standalone node acknowledges it. An invalid point rejects the entire batch.

## Query the measurements

```sh
curl --fail-with-body http://127.0.0.1:9070/query \
  -H 'Content-Type: application/json' \
  --data-binary '{"sql":"SELECT device, COUNT(*) AS n, AVG(value) AS average FROM temperature GROUP BY device ORDER BY device"}'
```

On a fresh database, `dev-001` has two rows and an average of `21.75`; `dev-002` has one row and an average of `19.0`. Response values use the server's typed JSON representation.

## Verify persistence

Stop the server with Ctrl-C. Start it again with the **same config and directory**, wait for `/readyz`, and repeat the query. The measurements should still be present. This checks orderly restart recovery, not every possible hardware failure.

## Understand the sample policy

The sample `temperature` table deduplicates on `(timestamp, device)`. Repeating this exact batch does not create additional logical rows, but it can add WAL bytes. A later correction replaces a whole row. Other measurements append by default.

Continue with [writing data](/smts/docs/writing-data/), [SQL queries](/smts/docs/sql/), and [duplicate handling](/smts/docs/data-model/).
