user-chefWelcome to the Cookbook

Bite-sized code recipes, cooked and ready to serve.

The Cookbook contains detailed coding snippets known as recipes. Recipes are focused and reusable. They are designed to be referenced, copied, and adapted. They are not meant to be read end-to-end.

Prepped snippets for when you just need the ingredients.

chevron-rightWho is the Cookbook for?hashtag

For developers beyond the exploratory phase who require a specific, concrete code solution quickly for an existing application.This section provides focused, reusable Clarity and Stacks.js code snippets that solve common problems or demonstrate specific patterns—designed to be referenced, copied, and adapted rather than read end-to-end.

circle-info

If you’re still learning core concepts, start with the main guides in the Build section. Come back here when you know what you’re trying to build.

What you’ll find here

  • Minimal, working Clarity snippets.

  • Minimal, working Stacks.js snippets.

  • Small patterns you can reuse across apps and contracts.

  • Notes on gotchas, tradeoffs, and safe defaults.

How to use the recipes

  1. Pick the closest recipe to your goal.

  2. Copy the snippet into your project.

  3. Replace placeholders like SP…, contract names, and network settings.

  4. Add your app’s error handling and UX.

circle-exclamation

Jump right in

Conventions and placeholders

  • Addresses use SP… (mainnet) and ST… (testnet) unless noted.

  • Contract identifiers use SP….contract-name.

  • Replace NETWORK / STACKS_API_URL with your environment.

  • Prefer explicit versions in your app.

chevron-rightWant to contribute a recipe?hashtag

Head to the Stacks Docs Github repoarrow-up-right and submit a PR. Add a new page under the closest section. Keep it short and sweet. Use the same structure: Title, Byline, Code, Description, Use Cases, Key Concepts.

Be sure to also include a byline of your Github or Twitter handle at the top of the page.

Last updated

Was this helpful?