A community based topic aggregation platform built on atproto

docs(backlog): Add code TODOs from codebase to PRD_BACKLOG

Added infrastructure/technical TODOs:
- OAuth authentication for community actions (P1)
- Jetstream consumer race condition (P2)
- Structured logging migration (P3)
- PDS URL resolution from DID (P3)
- PLC directory registration for prod (P3)

Feature-specific TODOs (avatars, moderator checks, update/delete handlers)
are tracked in their respective PRDs (PRD_COMMUNITIES, PRD_GOVERNANCE).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

Changed files
+57
docs
+57
docs/PRD_BACKLOG.md
···
**Solution:** Auto-refresh tokens before PDS operations. Parse JWT exp claim, use refresh token when expired, update DB.
+
**Code:** TODO in [communities/service.go:123](../internal/core/communities/service.go#L123)
+
+
---
+
+
### OAuth Authentication for Community Actions
+
**Added:** 2025-10-11 | **Effort:** 2-3 days
+
+
**Problem:** Subscribe/unsubscribe and community creation need authenticated user DID. Currently using placeholder.
+
+
**Solution:** Extract authenticated DID from OAuth session context. Requires OAuth middleware integration.
+
+
**Code:** Multiple TODOs in [community/subscribe.go](../internal/api/handlers/community/subscribe.go#L46), [community/create.go](../internal/api/handlers/community/create.go#L38)
+
---
## 🟢 P2: Nice-to-Have
···
---
+
### Jetstream Consumer Race Condition
+
**Added:** 2025-10-11 | **Effort:** 1 hour
+
+
**Problem:** Multiple goroutines can call `close(done)` concurrently in consumer shutdown.
+
+
**Solution:** Use `sync.Once` for channel close or atomic flag for shutdown state.
+
+
**Code:** TODO in [jetstream/user_consumer.go:114](../internal/atproto/jetstream/user_consumer.go#L114)
+
+
---
+
## 🔵 P3: Technical Debt
### Consolidate Environment Variable Validation
···
**Added:** 2025-10-11 | **Effort:** Ongoing
Document: did:plc choice, pgcrypto encryption, Jetstream vs firehose, write-forward pattern, single handle field.
+
+
---
+
+
### Replace log Package with Structured Logger
+
**Added:** 2025-10-11 | **Effort:** 1 day
+
+
**Problem:** Using standard `log` package. Need structured logging (JSON) with levels.
+
+
**Solution:** Switch to `slog`, `zap`, or `zerolog`. Add request IDs, context fields.
+
+
**Code:** TODO in [community/errors.go:46](../internal/api/handlers/community/errors.go#L46)
+
+
---
+
+
### PDS URL Resolution from DID
+
**Added:** 2025-10-11 | **Effort:** 2-3 hours
+
+
**Problem:** User consumer doesn't resolve PDS URL from DID document when missing.
+
+
**Solution:** Query PLC directory for DID document, extract `serviceEndpoint`.
+
+
**Code:** TODO in [jetstream/user_consumer.go:203](../internal/atproto/jetstream/user_consumer.go#L203)
+
+
---
+
+
### PLC Directory Registration (Production)
+
**Added:** 2025-10-11 | **Effort:** 1 day
+
+
**Problem:** DID generator creates did:plc but doesn't register in prod mode.
+
+
**Solution:** Implement PLC registration API call when `isDevEnv=false`.
+
+
**Code:** TODO in [did/generator.go:46](../internal/atproto/did/generator.go#L46)
---