Source: https://frameworkrecipes.dev/

Implementation, failure path, check

# Build the feature. Keep the guarantees.

Implementation recipes for transactions, authorization, concurrency and resource lifetime. Follow the code, exercise the failure path, then check the requirement after an agent edit.

[**Authorize the atomic update**Keep tenant and owner scope inside the FastAPI write.](https://frameworkrecipes.dev/fastapi/tenant-cancellation/)[**Make the event commit with the order**Trace a transaction through its failure path.](https://frameworkrecipes.dev/fastapi/outbox-transaction/)[**Follow ownership and lifetime**Axum implementations, regressions and saved checks.](https://frameworkrecipes.dev/axum/)

32 environments across 19 languages, with 64 advanced recipes. Inspect transaction boundaries, authorization, request races, queues and resource lifetime through actual source examples and captured Perch controls.

Find a language, framework or correctness problem

32 environments shown

Python

## [FastAPI](https://frameworkrecipes.dev/fastapi/)

### [Preserve tenant authorization inside an atomic FastAPI update](https://frameworkrecipes.dev/fastapi/tenant-cancellation/)

### [Keep a FastAPI order update and its outbox event in one transaction](https://frameworkrecipes.dev/fastapi/outbox-transaction/)

Python

## [Django](https://frameworkrecipes.dev/django/)

### [Keep Django cancellation writes scoped to the authenticated tenant](https://frameworkrecipes.dev/django/scoped-cancellation/)

### [Create a Django outbox event atomically with the order change](https://frameworkrecipes.dev/django/durable-outbox/)

TypeScript

## [Next.js](https://frameworkrecipes.dev/nextjs/)

### [Authorize a Next.js Server Action at the database write](https://frameworkrecipes.dev/nextjs/server-action-ownership/)

### [Prevent private Next.js order responses from entering shared caches](https://frameworkrecipes.dev/nextjs/private-response-cache/)

JavaScript

## [Express](https://frameworkrecipes.dev/express/)

### [Reserve stock in Express with one conditional database update](https://frameworkrecipes.dev/express/transactional-reservation/)

### [Return the PostgreSQL client after every Express transaction outcome](https://frameworkrecipes.dev/express/transaction-cleanup/)

Ruby

## [Rails](https://frameworkrecipes.dev/rails/)

### [Serialize Rails stock reservations with an Active Record row lock](https://frameworkrecipes.dev/rails/locked-stock/)

### [Reject stale Rails cancellation decisions with optimistic locking](https://frameworkrecipes.dev/rails/optimistic-cancellation/)

PHP

## [Laravel](https://frameworkrecipes.dev/laravel/)

### [Dispatch Laravel order jobs only after the transaction commits](https://frameworkrecipes.dev/laravel/after-commit-job/)

### [Use a conditional Laravel update to prevent overselling](https://frameworkrecipes.dev/laravel/atomic-reservation/)

Python

## [Flask](https://frameworkrecipes.dev/flask/)

### [Keep Flask request connections from leaking on error paths](https://frameworkrecipes.dev/flask/request-db-cleanup/)

### [Deduplicate a signed Flask webhook inside its state transaction](https://frameworkrecipes.dev/flask/webhook-deduplication/)

JavaScript

## [Fastify](https://frameworkrecipes.dev/fastify/)

### [Keep Fastify permission hooks inside the protected plugin](https://frameworkrecipes.dev/fastify/plugin-permissions/)

### [Keep Fastify reservation and order writes on the same transaction client](https://frameworkrecipes.dev/fastify/shared-transaction-client/)

TypeScript

## [Hono](https://frameworkrecipes.dev/hono/)

### [Enforce Hono JWT permissions after verification and before mutation](https://frameworkrecipes.dev/hono/jwt-permission-scope/)

### [Persist a Hono notification record before post-response dispatch](https://frameworkrecipes.dev/hono/waituntil-after-persistence/)

PHP

## [Symfony](https://frameworkrecipes.dev/symfony/)

### [Keep Symfony object authorization before the order write](https://frameworkrecipes.dev/symfony/object-voter-before-write/)

### [Keep Symfony inventory and order writes on one Doctrine transaction](https://frameworkrecipes.dev/symfony/dbal-transaction-handle/)

Java

## [Spring Boot](https://frameworkrecipes.dev/spring-boot/)

### [Keep Spring order confirmation and its outbox write under one proxy transaction](https://frameworkrecipes.dev/spring-boot/transactional-outbox/)

### [Require Spring method security before a scoped order mutation](https://frameworkrecipes.dev/spring-boot/method-write-permission/)

Kotlin

## [Ktor](https://frameworkrecipes.dev/ktor/)

### [Apply backpressure to Ktor background work with a bounded coroutine channel](https://frameworkrecipes.dev/ktor/bounded-request-worker/)

### [Preserve Kotlin coroutine cancellation in a Ktor service](https://frameworkrecipes.dev/ktor/cancellation-propagation/)

Go

## [Gin](https://frameworkrecipes.dev/gin/)

### [Keep Gin reservation and order creation on database/sql’s transaction handle](https://frameworkrecipes.dev/gin/reservation-transaction/)

### [Keep Gin’s pooled context out of the background queue](https://frameworkrecipes.dev/gin/immutable-background-jobs/)

Go

## [Echo](https://frameworkrecipes.dev/echo/)

### [Prevent privileged-field binding in an Echo profile mutation](https://frameworkrecipes.dev/echo/explicit-profile-dto/)

### [Carry Echo cancellation through to the database query](https://frameworkrecipes.dev/echo/request-context-database/)

C#

## [ASP.NET Core](https://frameworkrecipes.dev/aspnet-core/)

### [Authorize the loaded ASP.NET Core order before saving changes](https://frameworkrecipes.dev/aspnet-core/resource-authorization/)

### [Return a conflict when EF Core detects a stale order edit](https://frameworkrecipes.dev/aspnet-core/optimistic-concurrency/)

Elixir

## [Phoenix](https://frameworkrecipes.dev/phoenix/)

### [Keep Phoenix order and audit changes in one Ecto.Multi](https://frameworkrecipes.dev/phoenix/multi-transaction/)

### [Insert an Oban job in the same transaction as the Phoenix order change](https://frameworkrecipes.dev/phoenix/oban-atomic-job/)

JavaScript

## [React](https://frameworkrecipes.dev/react/)

### [Keep old React search responses from replacing the current query](https://frameworkrecipes.dev/react/stale-request-cleanup/)

### [Serialize and roll back an optimistic React cancellation](https://frameworkrecipes.dev/react/optimistic-mutation-rollback/)

JavaScript

## [Vue](https://frameworkrecipes.dev/vue/)

### [Cancel and invalidate Vue watcher requests before the next await](https://frameworkrecipes.dev/vue/watcher-cancellation/)

### [Dispose Vue realtime subscriptions when the owner disappears](https://frameworkrecipes.dev/vue/subscription-lifecycle/)

TypeScript

## [Angular](https://frameworkrecipes.dev/angular/)

### [Cancel obsolete Angular HttpClient searches with switchMap](https://frameworkrecipes.dev/angular/switchmap-search/)

### [Keep Angular form extras out of the profile mutation payload](https://frameworkrecipes.dev/angular/typed-profile-projection/)

TypeScript

## [SvelteKit](https://frameworkrecipes.dev/sveltekit/)

### [Authorize a SvelteKit form action before its conditional write](https://frameworkrecipes.dev/sveltekit/server-action-authorization/)

### [Keep SvelteKit private SSR responses out of shared caches](https://frameworkrecipes.dev/sveltekit/private-ssr-state/)

TypeScript

## [Nuxt](https://frameworkrecipes.dev/nuxt/)

### [Keep Nuxt API mutations scoped to the server-verified session](https://frameworkrecipes.dev/nuxt/server-session-scope/)

### [Use Nuxt request-scoped state instead of a shared SSR ref](https://frameworkrecipes.dev/nuxt/request-local-ssr-state/)

TypeScript

## [NestJS](https://frameworkrecipes.dev/nestjs/)

### [Reject unlisted NestJS mutation fields at the validation pipe](https://frameworkrecipes.dev/nestjs/strict-input-boundary/)

### [Keep NestJS event persistence on the supplied TypeORM transaction manager](https://frameworkrecipes.dev/nestjs/outbox-transaction-manager/)

Rust

## [Axum](https://frameworkrecipes.dev/axum/)

### [Keep Axum’s verified tenant inside the SQLx order update](https://frameworkrecipes.dev/axum/tenant-conditional-write/)

### [Stop an Axum worker while it waits for queued input](https://frameworkrecipes.dev/axum/owned-worker-shutdown/)

Rust

## [Actix Web](https://frameworkrecipes.dev/actix-web/)

### [Keep Actix order reads scoped by ReqData identity](https://frameworkrecipes.dev/actix-web/request-scoped-identity/)

### [Bound Actix import input before scheduling blocking work](https://frameworkrecipes.dev/actix-web/bounded-import-validation/)

C++

## [Qt](https://frameworkrecipes.dev/qt/)

### [Protect Qt’s shared stock decision with one scoped mutex](https://frameworkrecipes.dev/qt/shared-stock-lock/)

### [Dispose Qt network replies after their completion signal](https://frameworkrecipes.dev/qt/network-reply-lifetime/)

Swift

## [Vapor](https://frameworkrecipes.dev/vapor/)

### [Keep Vapor’s order and audit writes on the Fluent transaction database](https://frameworkrecipes.dev/vapor/fluent-transaction-handle/)

### [Observe Swift task cancellation between bounded order-processing steps](https://frameworkrecipes.dev/vapor/swift-cancellation-check/)

Dart

## [Flutter](https://frameworkrecipes.dev/flutter/)

### [Reject stale Flutter search results after a newer query or disposal](https://frameworkrecipes.dev/flutter/generation-safe-search/)

### [Cancel Flutter timers and streams when the screen is disposed](https://frameworkrecipes.dev/flutter/owned-subscription-disposal/)

R

## [Shiny](https://frameworkrecipes.dev/shiny/)

### [Check Shiny session authorization inside the write observer](https://frameworkrecipes.dev/shiny/session-scoped-mutation/)

### [Remove Shiny’s session-owned temporary files on session end](https://frameworkrecipes.dev/shiny/session-temp-cleanup/)

Scala

## [http4s](https://frameworkrecipes.dev/http4s/)

### [Release http4s response resources after success or decoding failure](https://frameworkrecipes.dev/http4s/client-response-resource/)

### [Keep a doobie reservation and order insert in one transaction](https://frameworkrecipes.dev/http4s/doobie-conditional-reservation/)

Clojure

## [Ring](https://frameworkrecipes.dev/ring/)

### [Keep Ring mutation permissions at the request handler](https://frameworkrecipes.dev/ring/session-permission-boundary/)

### [Release Clojure file resources when parsing an order fails](https://frameworkrecipes.dev/ring/stream-close-on-exception/)

Lua

## [OpenResty](https://frameworkrecipes.dev/openresty/)

### [Protect OpenResty stock decisions across workers with a shared lock](https://frameworkrecipes.dev/openresty/shared-dictionary-lock/)

### [Do not acknowledge OpenResty background work before timer admission](https://frameworkrecipes.dev/openresty/timer-admission/)

C

## [POSIX services](https://frameworkrecipes.dev/posix/)

### [Preserve complete POSIX writes when appending an order record](https://frameworkrecipes.dev/posix/complete-write-loop/)

### [Close a POSIX file descriptor even when synchronization fails](https://frameworkrecipes.dev/posix/failure-path-descriptor/)

## Turn a correction into a saved Perch rule

Each recipe gives your agent a concrete requirement, a focused check, and a repair/recheck workflow. Inspect the captured finding, adapt the example and regression tests, and commit the rule beside your code. The next agent session and CI can check the same requirement.

Published by Perch / Verglas LLC.

## Find the requirement an agent must preserve

[Repair workflows by failure: code, recorded checks and downloadable rules](https://frameworkrecipes.dev/problems/)

- [Stop stale responses from replacing newer state](https://frameworkrecipes.dev/problems/stale-responses/)
- [Keep authorization inside the database write](https://frameworkrecipes.dev/problems/authorization-at-the-write/)
- [Keep state changes and events in one transaction](https://frameworkrecipes.dev/problems/transaction-boundaries/)
- [Reject stale edits and serialize competing writes](https://frameworkrecipes.dev/problems/concurrent-writes/)
- [Preserve completed work and reject duplicate delivery](https://frameworkrecipes.dev/problems/retry-safe-work/)
- [Release resources on success, failure and disposal](https://frameworkrecipes.dev/problems/resource-cleanup/)

## Choose the failure path your agent is changing

For browser state that arrives out of order, start with [React search cleanup and optimistic rollback](https://frameworkrecipes.dev/react/). For competing database writes, start with [Rails row locks and stale cancellation checks](https://frameworkrecipes.dev/rails/). The framework guides connect the implementation, regression example and downloadable rule pack.

**Framework Recipes**

Implementation, failure path, check.

Published by Perch · © 2026 Verglas LLC. Framework Recipes is a Perch publication.

Perch’s MIT license covers the CLI; hosted model analysis is a paid service. Relevant source is sent to the configured model service.

[Perch CLI MIT license](https://github.com/lakeday-org/perch/blob/main/LICENSE) · [Article text](https://frameworkrecipes.dev/index.md) · [Resource index](https://frameworkrecipes.dev/llms.txt)

[Privacy](https://frameworkrecipes.dev/privacy/) ·
