Spec stable paging for a live activity feed

Vibe codingMedium25 minStripe and Meta style

Your task

Your Go service serves a mobile app's activity feed, newest first, 30 items at a time. New events arrive every second, and moderators delete some.

The endpoint pages with ?page=N and SQL OFFSET. Users see the same post twice as they scroll, and deep pages are slow. An agent will rewrite the endpoint.

Write the spec you would hand the agent.

What you know:

  • Go, pgx and Postgres
  • events(id bigint, user_id, created_at timestamptz, body), with id from a sequence and created_at defaulting to now()
  • a fan-out job writes each batch of events in one transaction
  • older app versions send ?page=N and will be around for 6 months

Then, in a few sentences: what does "add pagination with page and limit" produce on a feed like this?