Quickstart
This guide shows how to run Scratch Data locally, connect it to your database, and stream data to and from your database.
Run Scratch Data
Download the latest version of Scratch Data for your platform:
Then run the command:
$ ./scratchdata
API Running on http://localhost:3000
API Data: ./data/ingest
Database Created: Type=DuckDB File=./db.duckdb API Key=test_key
Congratulations! You now have a local instance of Scratch ready to accept data. By default, this sets up a local instance of DuckDB for reading and writing records along with a local folder for intermediate data.
Read and Write Data
Now that we have Scratch running, let's insert some data:
curl -X POST "http://localhost:3000/data?table=events&api_key=test_key" \
--json '{"user": "alice", "event": "click"}'
We can query just as easily:
curl -G "http://localhost:3000/query" \
--data-urlencode="api_key=test_key" \
--data-urlencode="q=select * from events"
This will output the following:
Summary
That's it! With this quickstart, you've been able to download and run Scratch Data, connect an analytics database (in this case, a local DuckDB file), and use REST to stream data in and out.
The rest of the documentation will describe how to connect other databases, along with other configuration options for the server.