Course lesson 40 · Advanced Durable Objects

Build a SQL backed Durable Object

One study unit · Read, recall, then practice · Original video 00:16:36

The tracker becomes a SQLite-backed Durable Object with a small geographic click table and an insertion method. A temporary HTTP endpoint reads the table so storage can be verified before WebSockets are introduced. The redirect’s background helper now enqueues the original analytics event and then writes usable geographic data to the correct account object.

Primary source: course video 40 · Supplied English subtitles · 00:16:36.

Understand the idea

What the course does

  1. Create the tracker class and a table containing latitude, longitude, country, and time.
  2. Implement a parameterized insert method and a temporary query that returns up to 100 rows as JSON.
  3. Export the class, add its Durable Object binding and SQLite-class migration, then regenerate environment types.
  4. Extract the redirect’s background work into a helper that first sends the queue message.
  5. Resolve the account’s object, require usable geographic fields, and call its insert method.
  6. Proxy a temporary Hono route to the object, deploy, click a redirect link, and inspect the returned data.

Watch for

Recall before revealing

What determines whether two clicks share the same tracker database?

Reveal the explanation

They share it when their links belong to the same account and therefore resolve to the same Durable Object identity.

Try it

Explain how you would test account isolation using the temporary endpoint.

Check your result

You predict that clicks for account A appear under A’s endpoint while another account’s object remains separate.

Practice prompts and answer checks are added teaching material. Answer from memory first, then compare and explain any difference.

Rewatch only what you need

Open this lesson in your original course library and seek to the times below. Videos are not hosted on this site.

Companion primary documentation: What are Durable Objects?. For recorded API names, commands, limits, and prices, check the version you use.

← Previous   Next →