Other Functions

The starter function and the email function — simple but essential.

hello-world

The starter. Returns the payload you send, plus the current server timestamp. Use it to verify your backend is running and reachable.

// supabase/functions/hello-world/index.ts
Deno.serve((request: Request) => {
  return Response.json({
    ok: true,
    message: "Hello from your ChromeShip backend.",
    method: request.method,
    servedAt: new Date().toISOString(),
  });
});

resend-email

Sends transactional emails via Resend. Supports plain text, HTML, CC, BCC, reply-to, and attachments. The Resend API key stays server-side. Called by email.text(), email.html(), and email.send().

await email.send({
  to: "user@example.com",
  subject: "Your invoice",
  html: "<p>Attached is your invoice.</p>",
  attachments: [{ filename: "invoice.pdf", content: base64Pdf }],
});