Skip to main content

Cookbooks

End-to-end recipes you can copy into production. Each cookbook is a small working agent that solves one real commerce problem, wired through the CodeSpar SDK.

1 min read

Cookbooks

@codespar/sdkv0.9.0

Every cookbook is a runnable example — not pseudo-code. Copy the file, fill in your API key, and run it.

Cookbooks are runnable examples — copy the file, fill in your API key, and run. Use the csk_test_* key auto-minted at signup (or mint another at Dashboard → API Keys) — it resolves to a test project where the runtime routes to provider sandboxes via operator-funded shared connections, so the cookbook runs end-to-end without provider OAuth and without real-money side effects. For fully deterministic output that doesn't hit any upstream, declare per-session fixtures via cs.create({ mocks: {...} }) — see Test Mode for the strict-mode contract and envelope reference.


Payments

End-to-end commerce

Architecture patterns


How the cookbooks are structured

Every cookbook follows the same shape so you can skim one and jump to any other.

  1. The scenario. A one-paragraph problem statement — who the user is, what they want, what constraints apply.
  2. The code. A single file, fully typed, no dependencies beyond @codespar/sdk and what the scenario actually needs.
  3. Walkthrough. Why each part exists. What would break if you changed it.
  4. Test run. Exact CLI commands to execute the cookbook against sandbox and what the output looks like.
  5. Production checklist. What to change before you ship. Usually: environment, API key prefix, error handling for the failure mode that matters for that flow.

Build your own

Missing a scenario? All cookbooks live in content/docs/cookbooks/*.mdx in this repo. Click "Edit this page on GitHub" on any cookbook to contribute.

Next steps

Cookbooks | CodeSpar