Edge Functions
Server-side code that runs close to your users
Edge functions handle work that can't happen in the browser — API routes, webhook receivers, scheduled jobs, and anything that needs secret keys.

Creating a function
Describe what it should do:
Create an edge function that sends a welcome email
when a new user signs up, using Resend.The agent writes the function, deploys it, and wires it up to the auth trigger.
Common uses
| Use case | Example |
|---|---|
| API routes | Process form submissions, handle payments |
| Webhooks | Receive events from Stripe, GitHub, or other services |
| Scheduled jobs | Nightly cleanup, weekly reports, notification digests |
| Server-side logic | Call APIs that require secret keys |
Environment variables
Store API keys and secrets as environment variables. They're available inside edge functions but never exposed to the browser or included in the frontend bundle.
