Learn digital twins by building one.
A progressive course. You create a synthetic twin and work with it chapter after chapter: feed it observations, read its layers, change its state without losing anyone's update, follow its series and history, react to its events, export it with a fingerprint and prove who touched it. Each chapter unlocks when the previous one is done.
Simulated in your browser, synthetic data · nothing is sent anywhere
Every chapter shows the real status of what it teaches: Beta works for every account; Beta · in development is being built now and its names can still change. Your progress is kept in this browser only, when the browser allows it.
What a digital twin is
Goal: know the four ideas every other chapter builds on.
A digital twin is a living data model of something real. It is fed with observations, keeps itself up to date, and lets you ask the model instead of the real thing. In STARCO a twin is organised in layers (the built-in wellness and biomarkers, and custom layers you define), each with typed measures that have a unit and accepted bounds. When observations arrive, the affected layers are recomputed. The twin also keeps a current state (the latest value of each measure, with a version), the history of every change, events other systems can follow, an export with a fingerprint and an audit chain of every access.
Research groups
Model a cohort, ingest with strict validation, export with fingerprints for reproducible analysis.
Developers
Typed state, safe concurrent updates, series and webhooks without building storage and audit yourself.
Care organisations
An audit chain anyone can verify, and descriptive values only: no labels, no scores.
Curious individuals
Learn how twins work with synthetic people, here, with no account.
Your task: answer the three questions.
What just happened
These are the house rules. A missing value is null, never an invented zero or a typical value. Values are descriptive: counts, latest, min, max, means; never normal, high, low, risk or scores. And nothing is converted silently: a wrong unit or a value out of bounds is refused with a stable reason code, so your pipeline can fix it.
Your project and key Beta
Goal: create a project (it comes with a synthetic cohort of 8 twins) and a project key with the read and write scopes.
You are signed in to the console of a synthetic developer account. A project holds twins, keys and its own audit chain. A project key (starco_dk_…) is what your code sends; its secret is shown once. Type the commands, or press a suggestion to put it on the line, then press Enter.
Your task: have an active key with both scopes.
What just happened
The console saved the project id as $PROJECT and the key as $KEY, as you would in an environment variable. The list shows the key's prefix, never its secret: the platform keeps only a keyed hash. From now on every request made with the key is a row of the project's audit chain, including the ones that are refused.
Where this helps: one key per service and per environment, each with only the scopes it needs, expiring in at most 90 days.
A twin from a template Beta
Goal: look at the catalogue and create your own twin with the wellness and biomarkers layers.
A template chooses which measures come first; the layers choose which measures exist at all. A twin without the biomarkers layer refuses heart-rate data: it only holds what you chose.
Your task: create a twin with both layers.
What just happened
Your twin has a UUID (saved as $TWIN), "origin": "api" and "data_class": "synthetic". Its layers exist but are empty: every count is 0 and every value is null. The 8 twins of the cohort say synthetic_cohort: they came with the project, with two weeks of synthetic steps and sleep.
Observations and layers Beta
Goal: send a batch with one wrong line on purpose, then read the recomputed wellness layer.
An observation is one measured value at one time: kind, value, unit, observed_at. Each line of a batch is checked on its own. A refused line is never stored, not even in part, and the layers it touched are recomputed before the answer.
Your task: get a batch with at least one accepted and one rejected line, then read the wellness layer.
What just happened
The sleep line said min where the unit is h: it came back as unit_mismatch with the expected unit, and nothing of it was stored. The two step lines were stored and recomputed_layers said wellness. The layer shows count, latest, min, max, mean and mean_last_7_days for steps, and null for every measure without data.
Where this helps: a research pipeline gets one reason per refused line and can fix its source, instead of finding silent conversions months later.
The twin's current state Beta
Goal: see the twin's typed measures, set the current value of two of them and read one back with its version.
Observations are the twin's past. Its current state is its present: one value per measure (wellness.mood_level, study.phase…), typed by its layer, with a version that only grows. A measure that was never set has no value: "has_value": false, null, version 0, never a default.
Your task: wellness.mood_level is 4 and wellness.stress_level is 2.
What just happened
Each write answered with the new version, an ETag header with the same number and a transaction_id. A value outside the measure's accepted bounds came back as value_out_of_accepted_bounds with the bounds in expected, and nothing changed. PATCH /state is all or nothing. GET /state lists only the measures with a value. The short line in command mode (POST …/cmd) is optional terminal sugar over the same operations. Every change wrote a state.changed event and a row of the audit chain.
Where this helps: an app shows the twin's present in one read, next to the layers computed from its past.
Safe concurrent updates Beta
Goal: cause a 409 version_conflict on purpose, then fix it by reading again.
Two apps read mood_level at the same version, both change it, and the last one silently overwrites the first. Compare-and-set prevents it: send the version you read, as if_version in the body or as If-Match: "<version>" (the ETag of your read), and the write only happens if nobody changed the measure in between. if_version: 0 means «only if it has no value yet».
- Read the measure: note its version.
- Press Another app writes: a second client with its own key changes it.
- Send your write with the version you read:
409. - Read again and retry with the new version:
200.
Your task: get a version_conflict, then a successful write with if_version or If-Match.
What just happened
The 409 answer carried expected_version (yours), current_version and has_value (the twin's), and changed nothing. After reading again you wrote on top of the other app's change, knowingly. A weak or half-quoted If-Match is refused (version_invalid): it never enables a write.
Where this helps: a care team's tablet and a sync job never overwrite each other's update without noticing.
Counters within bounds Beta
Goal: count glasses of water with an atomic increment, and watch the measure's bounds hold.
POST …/state/{measure}/incr adds to a number or integer measure in one atomic step, so two clients adding at once never lose a glass. It respects the measure's bounds (hydration_glasses accepts 0 to 20). And it never starts from an invented zero: a measure with no value must be set first.
Your task: see measure_has_no_value and value_out_of_accepted_bounds, and end with 19 or 20 glasses.
What just happened
The first increment was refused with 409 measure_has_no_value: the twin does not know how many glasses there were, so it does not pretend it was zero. Past 20 the increment was refused with the bounds in expected, and the value stayed where it was.
Several changes at once Beta
Goal: apply two changes all-or-nothing, guarded by a watch on the version you read.
A transaction (POST …/tx) is an ordered list of operations (set, incr, del, append) applied together or not at all. With watch you name the versions you based it on: if any changed, nothing is applied and you get 409 watch_failed with the conflicts.
Your task: press Another app writes between your read and your transaction to get a watch_failed, then read again and commit.
What just happened
The first run changed nothing: not even the operation that had nothing to do with the watched measure. The second returned "committed": true, one transaction_id and each operation's new value and version; the history of both measures carries that transaction id.
Where this helps: close a day or move a value between two measures without a half-applied state if anything goes wrong.
Series by day Beta
Goal: append a week of sleep to the series of a measure and read it back in daily buckets, gap included.
Each stored numeric measure has a series: its observations in time order, the same ones its layer is computed from. You append points {"t", "v"}, checked like observations, and read a range raw or in UTC buckets (1m to 7d) with avg, min, max, sum, count, first or last.
Your task: read the week in daily buckets and find the missing night.
What just happened
The repeated night came back as duplicate_observation: a stored point is never overwritten. The daily range had six buckets, buckets_expected: 7 and buckets_missing: 1; with fill=null the missing night is listed as "v": null, "n": 0, never a zero or an interpolation. The points are observations, so the wellness layer was recomputed and a series.appended event was written.
Where this helps: statistics that account for gaps, instead of quietly averaging over them.
History of a measure Beta
Goal: list every change of a measure: old and new value, version, operation, time, transaction and the key that made it.
The state keeps only the present; the history keeps how it got there (the last 1000 changes of each measure). Each entry names the operation (set, incr, del, or derive for a calculated measure) and the prefix of the key that made it, never its secret.
Your task: read a history with at least two entries.
What just happened
You saw the other app's write from chapter 6 next to yours, each with its own key prefix. DELETE does not erase the past: the measure has no value now, its version still grew, and the history keeps the value it had.
Where this helps: answer «who changed this, and when?» without digging through logs.
Your own layer schema Beta
Goal: define a custom layer with typed measures, create a twin with it next to a built-in layer, and see the types enforced.
A layer schema defines a custom layer (study, rehab…) and its measures: name, type (number, integer, boolean, string, enum, json), a unit and accepted bounds for numbers, the allowed values of an enum, or an expression for a derived measure. A schema is never changed: posting the same layer again creates its next version, and a twin keeps the version it was created with.
Your task: the study twin has study.water_ml set.
What just happened
The study twin has the built-in wellness layer of its template and your study layer, listed together by GET …/measures as layer.measure. "medium" came back as value_not_in_enum with the allowed values. A built-in name such as wellness cannot be taken (layer_reserved), and texts that look like identifiers are refused: the sandbox is synthetic.
Where this helps: a study protocol becomes a schema, and every site sends data that fit it or get a reason code.
Derived measures Beta
Goal: watch a calculated measure follow its inputs, and see that it never invents a value.
study.ml_per_kg is derived: its expression is round(water_ml / weight_kg, 1). Expressions use numbers, + - * / ( ), min, max, abs, round and the stored number measures of the same layer; they are parsed, never run as code. A derived measure is recomputed in the same transaction as the input that changed, with its own version and history (derive). With an input missing, or a division by zero, it has no value.
Your task: get a value for study.ml_per_kg, and see measure_is_derived when you try to set it.
What just happened
Setting weight_kg answered with a derived list: study.ml_per_kg became 25 in the same transaction. Setting it directly was refused (measure_is_derived, with its inputs). Removing an input took its value away again: no value, not a stale one and not a zero. Its history shows each derive.
Where this helps: ratios and totals a team agrees on, always consistent with the values they come from.
Events and signed webhooks Beta
Goal: follow the project's events, subscribe a webhook, verify a delivery's signature and catch a tampered one.
Every change in a project is an event (twin.created, twin.deleted, schema.created, state.changed, series.appended) you read by cursor with GET /v1/events?after=…, kept 30 days. A webhook pushes them to your endpoint, signed: X-Starco-Signature: t=<unix time>,v1=<hex>, the HMAC-SHA256 of "<t>.<raw body>" with the webhook's secret. Only https on port 443 to a public host name: no IP literals, local names or private addresses (the real API also resolves the name before every delivery). Here the receiving end, hooks.example.test, is simulated in the page.
Your task: verify one genuine delivery, then tamper with its body and see the check fail.
What just happened
Your receiver recomputed HMAC-SHA256(secret, t + "." + body) and compared it with v1: equal, so the body came from STARCO and was not changed. One changed character and the signatures differ. Check that t is recent too, so an old delivery cannot be replayed. The delivery log lists status, attempts and HTTP code, never your endpoint's answer.
Export with a fingerprint Beta
Goal: export your twin and confirm that the bytes you received are the ones STARCO fingerprinted.
The export is one JSON document (starco-dev-export/v1) with the twin, its layers, its observations, its measures and its current state. The X-Content-SHA256 header is the SHA-256 of exactly those bytes, and the same fingerprint is written to the audit chain.
Your task: recompute the fingerprint of the bytes you received and get a match.
What just happened
Same bytes, same SHA-256. Change a single value and the fingerprint is different, so anyone you hand the file to can check it against the audit chain. For reproducible research, cite the fingerprint next to the dataset.
Verify the audit chain Beta
Goal: verify the chain of everything you did, tamper with one row and watch the verification point at it.
Each row's row_hash is the SHA-256 of "starco-dev-audit/v1\n" + project_id + "\n" + seq + "\n" + prev_hash + "\n" and one field=<byte length>:<value> line per field. Each row includes the previous row's hash, so changing any row breaks every link after it. Rows name measures, versions and counts, never a value.
Your task: get "ok": true, tamper with a row, then get "ok": false with the row's first_broken_seq.
What just happened
The verification walked the chain from the genesis (64 zeros) and stopped at the first row whose content no longer matched its hash: content_changed. You can do the same walk yourself with GET /v1/audit, which returns every hashed field: no secret is needed to check it.
The SDK and the CLI Beta · in development
Goal: do in one line what you did with HTTP: read state, set it safely and read a series.
starco command line are written and run end to end against the API; they are not published yet, so nothing here can be installed.import os, starco
c = starco.Client(api_key=os.environ["STARCO_KEY"])
mood = c.state.get(TWIN_ID, "wellness.mood_level") # value, version
c.state.set(TWIN_ID, "wellness.mood_level", 4, if_version=mood["version"])
week = c.series.range(TWIN_ID, "wellness.sleep_hours", bucket="1d", agg="avg")starco twin get $TWIN wellness.mood_level
starco twin set $TWIN wellness.mood_level 4 --if-version 3
starco series range $TWIN wellness.sleep_hours --bucket 1d --agg avgTry the command line in the console: it maps each command onto one request of the same API.
Your task: run starco twin get and starco series range.
What just happened
Every CLI command became one API request, shown under it, with the same answers and reason codes. The SDKs wrap the same requests and raise a typed error with the code (version_conflict, value_out_of_accepted_bounds…) so your code can branch on it.
An AI assistant through MCP Beta
Goal: give an assistant one hour of read-only access to your project, call its tools as it would, and see what it can never do.
Each synthetic project has an MCP server: an assistant holds a starco_dm_… token (read-only, one hour, one project) and calls six tools over JSON-RPC: twins.list, twin.get, layer.get, series.range, history.get and audit.verify. There is no tool that writes. MCP needs Accept: application/json, text/event-stream; the console adds Content-Type: application/json to every body.
Your task: call a read tool through tools/call, and see a write tool refused.
What just happened
The tool answered with content and structuredContent, read through the same services as the REST API. The write tool does not exist: -32602 Unknown tool or invalid arguments, so it is not a matter of the assistant behaving. The MCP token cannot call the REST API either, and your project key cannot call MCP. Every MCP request is a row of your audit chain (actor_type: mcp).
Academy complete
STARCO Dev Academy
Digital twins, from first layer to verified audit chain
17 chapters completed: layers and typed measures, observations, the current state with versions, safe concurrent updates, counters within bounds, transactions, series, history, layer schemas, derived measures, events and signed webhooks, fingerprinted export, the audit chain, SDK and CLI, and assistants through MCP.
- completed on
- not yet
- certificate fingerprint
- not yet
No name and no personal data: the fingerprint is the SHA-256 of the course version and the completion date. Simulated, synthetic data.