Usage¶
This page explains how to use the cookbook effectively as a recipe catalog.
Core model¶
Use the repository in this order:
- Pick a pattern in
recipes/. - Run the matching implementation in
examples/. - Adapt the sample for your own function app.
- Validate with tests, lint, and security checks.
Info
There is no package API to import from this repository for app runtime. The value is in the recipe content and runnable examples.
How recipes are organized¶
Current recipes:
http-api-basichttp-api-openapigithub-webhookqueue-workertimer-job
Each recipe targets a specific trigger style and operational concern.
| Recipe | Trigger | Focus |
|---|---|---|
| HTTP API Basic | HTTP | Route design, request handling, CRUD baseline |
| HTTP API with OpenAPI | HTTP | API contract generation and Swagger UX |
| GitHub Webhook | HTTP | Signature validation, event routing |
| Queue Worker | Queue | Async processing, retries, message safety |
| Timer Job | Timer | Scheduled execution, deterministic periodic tasks |
Recipe format contract¶
New or updated recipe files should follow recipes/_template.md:
- Overview
- When to Use
- Architecture
- Project Structure
- Run Locally
- Production Considerations
- Scaffold Starter
This consistent section contract keeps pages easy to scan and compare.
Mapping between recipes and examples¶
Each recipe has a runnable app under examples/:
recipes/http-api-basic.md->examples/http_api_basicrecipes/http-api-openapi.md->examples/http_api_openapirecipes/github-webhook.md->examples/github_webhookrecipes/queue-worker.md->examples/queue_workerrecipes/timer-job.md->examples/timer_job
Tip
Keep docs and example code aligned in the same pull request. If behavior changes in code, update recipe narrative and run instructions.
Typical usage patterns¶
Pattern discovery¶
- Start with Recipes Overview
- Select by trigger and operational needs
- Open the deep-dive recipe page
Prototype quickly¶
- Copy structure from an existing example
- Keep trigger decorator style (
func.FunctionAppv2 model) - Replace placeholder business logic first
Production hardening¶
- Add input validation and explicit status codes
- Add idempotency for webhook and queue workflows
- Add observability and clear error paths
- Add security controls from Security
Contributing new recipes¶
Recommended flow:
- Duplicate
recipes/_template.mdinto a new recipe page. - Add a matching runnable project under
examples/. - Document local run steps and expected output.
- Include production constraints and failure behavior.
- Add docs navigation entry in
mkdocs.yml.
See Contributing Guidelines for review standards.
Ecosystem integration¶
The cookbook is designed to work with companion projects:
azure-functions-scaffoldfor generating starter projectsazure-functions-validationfor request/response validation helpersazure-functions-openapifor contract generation and Swagger UIazure-functions-loggingfor structured logsazure-functions-doctorfor local environment checks
Use recipes as the architecture baseline, then apply ecosystem tooling incrementally as your app matures.
Anti-patterns to avoid¶
- Treating examples as production-ready without review
- Copying snippets without local test execution
- Keeping secrets in source code
- Ignoring retry/idempotency behavior for queue and webhook patterns
- Updating examples without updating documentation
Useful links¶
- Start here: Getting Started
- Build and test: Development, Testing
- Diagnose problems: Troubleshooting
- Read all recipes: Recipes Overview