A self-contained TanStack Start app that sends transactional email with Samva.
It includes both common TanStack Start send paths:
- A contact form that calls a
createServerFnthroughuseServerFn. - A raw
POST /api/sendserver route.
bun install
cp examples/tanstack-start-transactional/.env.example examples/tanstack-start-transactional/.envAdd a real SAMVA_API_KEY and a random SAMVA_SEND_TOKEN in .env. Both are
server-only and intentionally do not use a VITE_ prefix.
Your Samva account must have a verified sender/domain before production sends will deliver.
bun run --filter tanstack-start-transactional-samva devOpen http://localhost:3000 and submit the form.
curl -X POST http://localhost:3000/api/send \
-H "Authorization: Bearer replace-with-a-random-route-token" \
-H "Content-Type: application/json" \
-d '{
"to": "ada@example.com",
"subject": "Hello from TanStack Start",
"text": "This was sent through Samva."
}'The route returns { "ok": true } after Samva accepts the send. Invalid payloads
return 400.
src/lib/samva.tsbuilds the Samva client per request fromprocess.env.SAMVA_API_KEY.src/functions/send-email.tsdefines thecreateServerFnsend flow.src/routes/index.tsxrenders the contact form and callsuseServerFn.src/routes/api/send.tsexposes the raw HTTP route.
See the TanStack Start cookbook for the full walkthrough, including React Email and edge runtime notes.