Summary
The public profile endpoints in apps/backend/src/routes/public.ts are currently unprotected against abuse. Add a Fastify-compatible rate limiter using @fastify/rate-limit to protect /api/public/:username and related routes.
Context
This is important for production readiness as the public card view page is unauthenticated and could be scraped at scale.
Tasks
Acceptance Criteria
Difficulty
medium — requires understanding of Fastify plugin registration, middleware order, and HTTP conventions.
Summary
The public profile endpoints in
apps/backend/src/routes/public.tsare currently unprotected against abuse. Add a Fastify-compatible rate limiter using@fastify/rate-limitto protect/api/public/:usernameand related routes.Context
This is important for production readiness as the public card view page is unauthenticated and could be scraped at scale.
Tasks
@fastify/rate-limitinapps/backend.apps/backend/src/app.tswith global defaults (e.g. 100 req / 1 min per IP)./api/public/:username(e.g. 30 req / 1 min).{ error: 'Too Many Requests', retryAfter: N }with 429 status.apps/backend/src/__tests__/public.test.tsto assert the 429 path.apps/backend/README.md.Acceptance Criteria
Retry-Afterheader and structured body.pnpm --filter @devcard/backend test.Difficulty
medium— requires understanding of Fastify plugin registration, middleware order, and HTTP conventions.