Audit the app for real-time performance bottlenecks and fix them — slow queries, missing indexes, N+1 problems, cache misses, and polling that should be websockets. Use when the user says "make it faster", "it's slow under load", "optimize the DB", or "add real-time updates".
npx @senso-ai/shipables install KeyanVakil/realtime-readyFind what's slow and fix it before it becomes a production fire.
Read all database query code. Flag:
WHERE clauses on large tablesSELECT * where specific columns would doRead API route handlers. Flag:
await a; await b → await Promise.all([a, b]))Check for caching. Flag if none exists on:
1. Add missing indexes
-- Example: index on foreign keys and frequently filtered columns
CREATE INDEX CONCURRENTLY idx_orders_user_id ON orders(user_id);
CREATE INDEX CONCURRENTLY idx_orders_status_created ON orders(status, created_at DESC);
2. Fix N+1 queries Replace sequential per-row queries with a single batched query or JOIN.
3. Parallelize independent awaits
// Before
const user = await getUser(id)
const posts = await getPosts(id)
// After
const [user, posts] = await Promise.all([getUser(id), getPosts(id)])
4. Add response caching Cache at the route level for data that's the same for all users. Use short TTLs (30–60s) for dashboards, longer (5–10min) for reference data.
5. Replace polling with WebSockets or SSE If the client polls every few seconds for updates, replace with Server-Sent Events (simple, HTTP-native) or WebSockets (bidirectional).
After each fix, measure: query time, response time, or resource usage. Only keep changes that show measurable improvement.
CONCURRENTLY to avoid locking production tables