Astro
Astro actions
Astro actions is a typed way to call server code from a form or a client island without writing a fetch call by hand. You define the action once with an input schema and Astro handles the request, the validation, and the error shape.
How it is measured
Look in src/actions/index.ts for a server export built with defineAction. Each entry has an input schema, usually Zod, and a handler. Calls return an object with either data or error, and the schema rejects bad input before the handler runs.
Confirm it works by submitting a form with a missing field and reading the returned error. Then check that the route runs on demand, because actions need a server and an adapter to receive the POST.
Worked example
A bike shop's Astro site has a "notify me when back in stock" form on 9 product pages. The action takes an email and a SKU, validates the address with a schema, and writes a row to a database. A blank email returns a field error in 4 ms without touching the database.
Before actions, the shop had a hand-written endpoint and a client fetch that swallowed 500 responses. Two weeks of signups were lost with no error on screen.
How it differs
Astro actions wrap a typed call with validation and a result object. Astro endpoints are raw HTTP handlers where you read the request and build the response yourself. Actions exclude custom headers and arbitrary methods; endpoints exclude the schema and the typed client call.
Common errors
Building an action on a fully static site and finding no server to answer. Trusting client-side checks and skipping the schema. Putting secrets in the action input. Forgetting that thrown errors need the ActionError type to reach the form. Using an action for a public webhook that needs a stable URL and custom auth.
In practice
Move your one or two form handlers into actions this week and delete the matching fetch code. Write the input schema first, test one bad submission, and read the error that comes back. Leave webhooks and file downloads as endpoints.