Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

Turso 7 min read How-to mediumAdept

Save Resend email events to your Turso Database

Resend email webhook events (sent, delivered, bounced, opened, clicked, etc.) can be persisted to a Turso database through a small Hono/Node.js handler using @libsql/client. The walkthrough creates `events` and `clicks` tables. It parses the webhook payload, generates UUIDs, flattens recipient arrays to CSV, and inserts click details separately for `email.clicked` events. Local testing uses a Hookdeck CLI tunnel. Production advice covers verifying signatures with svix, queueing events for background processing, adding indexes, and deploying to a cloud host.

Assumes: Node.js basicsWebhooksBasic SQL

Related posts

  • Storing Vercel's AI SDK chat messages in a Turso database

    Turso mediumAdept

    Vercel AI SDK's useChat hook doesn't persist conversations, so chat history can be stored in a Turso (libSQL) table and reloaded on page render. A server component queries the messages table and passes rows as initialMessages to useChat. The API route inserts the user's last message before calling streamText, and an onFinish callback inserts the assistant's reply. Suggested extensions include a chats/sessions table with foreign keys, background persistence via server actions, or a database per user or chat.

  • Use SQLite triggers to send new user emails

    Turso mediumAdept

    An AFTER INSERT trigger on a users table copies each new row into a new_users outbox table. A Cloudflare Worker cron job polls that table every two minutes, sends welcome emails and deletes the processed rows. The tutorial covers trigger syntax, libSQL client setup, wrangler cron configuration and deployment. It notes the approach adds extra row reads and writes, and suggests Cloudflare Queues for retries or the libSQL /listen endpoint for high volume.

  • Write that blog… with Turso!

    Turso mediumAdept

    WriteThatBlog!, an aggregator of engineering blog posts tagged by writing pattern, is a single static HTML page on GitHub Pages that queries a replicated Turso database directly from the browser over HTTP, with no backend functions or proxies. A read-only auth token is deliberately embedded in the page because the data is public anyway. The schema is one five-column table, and content is managed with a small shell script around `turso db shell` that returns the ROWID, which makes later updates and deletes trivial.

  • Create a fast, performant admin UI with Retool and Turso

    Turso mediumAdept

    A Retool admin dashboard for an e-commerce mug store can read and write data in a Turso (libSQL) database through Turso's HTTP API, configured as a Retool REST API resource. The resource uses the database URL with https in place of libsql, plus a Bearer token header. Queries POST SQL statements, and a transform function maps the column/row response into objects for a Retool table. A form with a category select submits inserts, and a success handler refreshes the product list.

  • Create a database branch with GitHub Actions

    Turso mediumAdept

    A GitHub Actions workflow triggered on branch creation can call the Turso Platform API to seed a new database from an existing one, giving each Git branch its own isolated database. The workflow stores the API token, organization, group and source database name as repository secrets and names the new database after `github.ref_name`. It uses `curl -f` with exit-code checks to fail the job on API errors, then extracts the returned Hostname with `jq` and exports it to `GITHUB_ENV` for later steps such as deployments. Branch names must contain only lowercase letters, numbers and hyphens to be valid database names, and the official `tursodatabase/create-database-action` wraps the same logic.

The quest for software engineering knowledge.

Look:
Layout: