Guestbook Example

This capsule shows a shared feed where every signed entry stores author metadata from Lakebed auth.

What It Shows

Server Pattern

Use shared feeds when every user can read the same rows:

queries: {
  entries: query((ctx) => ctx.db.entries.orderBy("createdAt", "desc").limit(50).all())
}

Still keep writes server-authoritative:

ctx.db.entries.insert({
  body: trimmed,
  authorId: ctx.auth.userId,
  authorName: ctx.auth.displayName,
  authorPicture: ctx.auth.picture ?? ""
});

Do not accept authorId, authorName, authorPicture, or other trusted metadata from the client.

Run It

Run the checked-in example:

npx lakebed auth as alice
npx lakebed dev examples/guestbook

Open:

http://localhost:3000

To see shared updates from multiple identities, open:

http://localhost:3000/?lakebed_guest=alice
http://localhost:3000/?lakebed_guest=bob

Then inspect state:

npx lakebed db dump --port 3000
npx lakebed logs --port 3000