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 · updated

Cookbooks

@codespar/sdkv0.3.0

Every cookbook is a runnable example — not pseudo-code. Copy the file, fill in your API key, and it executes against CodeSpar's sandbox. Swap csk_test_ for csk_live_ when you're ready.

Every cookbook ships with a test key that points at CodeSpar's sandbox. You don't need provider accounts to get it running — mock data flows through end-to-end.


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

Edit on GitHub

Last updated on