Skip to content

Read-through-API: move client reads onto edge-cached v2 endpoints #38

Description

@rferrari

Why

The webapp (skatehive3.0) and mobile app read most display data directly from Hive RPC (feeds, profiles, posts, notifications, HP/vote math). That means multi-second round-trips, public-node flakiness with failover, and N+1 call patterns (a comment thread = many sequential get_content calls). Meanwhile the v2 API now edge-caches all reads (CDN-Cache-Control, commit 3bb3c8d).

This is the tracking issue for closing the remaining read gaps so clients can consume edge-cached v2 endpoints instead of hitting the chain directly. It's driven by an architectural audit of skatehive3.0 (AUDIT_READ_THROUGH_API.md).

Principles / decisions

  • Reads decouple from the chain; writes do not. Aioha + dhive stay the exclusive signing/broadcast path. Userbase (email/lite users) and Farcaster are untouched.
  • Extend v2, no v3. All additions are non-breaking new endpoints. Each client adapts response shape via its own adapter — versioning is not the tool for shape differences.
  • HAFSQL-first, dhive as fallback. Reads prefer our own Postgres (offloads public nodes, edge-cacheable, collapses N RPC calls into one join); dhive is the resilience layer and the source for data HAFSQL doesn't expose.
  • Some reads stay on-chain deliberately — they're part of write flows (follow-toggle read, waitForPost cross-post gating, key validation, pre-transfer balance) and need live state.

Endpoints (this repo)

Merge order: #35 first, then #36 and #37 (independent siblings).

/account was evaluated and not needed/profile + /balance already cover existence/metadata/balances; the only extra a raw account gives is keys/authorities, which are write-coupled and stay on-chain.

Follow-up (separate repos)

Testing

Unit tests via vitest (pnpm test, tests/unit/*.test.ts) introduced in #35; each endpoint ships unit + smoke coverage.

🤖 Generated with Claude Code

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions