We’re shipping a “profile views” counter so creators can see how much attention their profiles get. Build a backend endpoint that records a view instantly without hammering our primary database, and persist the totals asynchronously. We’re fine with a small delay (a few minutes) as long as the write path stays fast during spikes.

API
- Method: POST
- Path: /v1/users/{userId}/view
- Auth: JWT bearer to identify the viewer
- Body: none
- Success: 202 Accepted
- Errors: 404 if the profile doesn’t exist; 429 when the viewer is rate limited

Implementation direction
- Buffer increments in memory (e.g., Redis atomic counter like profile_views:{userId}) so the endpoint can return quickly.
- A scheduled job periodically aggregates these counters into Postgres (users.view_count) and clears the buffered values.

Please deliver the service (Node/Express is fine), the background job that drains counters, and a brief plan for key naming, batching, abuse controls, and failure handling.