Phased implementation plan for dashboard and dashboard-api to scale API performance and localization from 2 to 100 languages.
This roadmap translates the current architecture review into an implementation sequence for:
- workers/my-api API performance at larger data volumes
- apps/dashboard localization architecture for 100 languages
- multi-language search and fallback behavior across UI and API
Implementation backlog: Performance And Localization Implementation Backlog
Primary goals:
- keep p95 dashboard API list endpoints under 400ms at target data volume
- support 100 UI and content locales without major bundle-size regressions
- provide locale-aware search and deterministic fallback behavior
- preserve current product behavior while migrating in safe increments
Non-goals in this plan:
- redesigning ingestion enrichment providers
- changing core sharding strategy (unless explicitly called out in later phase options)
Current Constraints (Baseline)
Section titled “Current Constraints (Baseline)”Observed constraints to address:
- cross-shard list endpoints over-fetch with page * perPage per shard and then sort in memory
- search queries use English-only JSON paths (for example $.en)
- dashboard i18n statically imports locale resources into the initial bundle
- localized UI field components are hardcoded for only en and pt
- some date labels are formatted server-side in en-US
Delivery Model
Section titled “Delivery Model”- Phase duration: 1 to 3 weeks each
- Gate: each phase has explicit acceptance criteria and rollback strategy
- Deployment rule for worker changes: validate by production deploy + production route checks
Phase 0: Baseline, Guardrails, And Instrumentation (Week 1)
Section titled “Phase 0: Baseline, Guardrails, And Instrumentation (Week 1)”Objective: establish measurable baseline before behavioral changes.
Work items
Section titled “Work items”- Add structured timing and cardinality logs to dashboard-api list handlers.
- Emit per-request metrics:
- shard query count
- rows fetched before merge
- rows returned after pagination
- end-to-end duration
- Add dashboard web-vitals and i18n timing marks:
- app boot time
- i18n init time
- locale switch latency
- Define load-test fixtures for:
- publications list with deep page values
- people list with search and filters
- locale switching across many namespaces
Acceptance criteria
Section titled “Acceptance criteria”- baseline p50/p95 metrics recorded for 7 days in production
- top 3 slow query patterns identified with sample requests
- no user-facing behavior changes
Phase 1: Quick Wins (Low Risk) (Week 2)
Section titled “Phase 1: Quick Wins (Low Risk) (Week 2)”Objective: reduce immediate cost without schema redesign.
dashboard-api
Section titled “dashboard-api”- Cache frequently requested list pages for short TTLs with cache keys that include:
- workspace/entity
- all query filters
- page/perPage/sort/dir
- Add selective invalidation on write operations for affected namespaces.
- Move server-generated chart labels to client-side formatting by returning canonical keys only.
dashboard
Section titled “dashboard”- Set explicit TanStack Query defaults in root QueryClient for high-read endpoints:
- staleTime for list/read-heavy data
- bounded retry policy for 5xx and 429 only
- refetch behavior tuned per route
- Add optimistic locale switch prefetch for active route namespace.
Acceptance criteria
Section titled “Acceptance criteria”- p95 for cached list requests improves by at least 30%
- zero correctness regressions in list totals and pagination metadata
- timeseries labels render correctly in active locale
Phase 2: Scalable Pagination And Query Path (Week 3 to 5)
Section titled “Phase 2: Scalable Pagination And Query Path (Week 3 to 5)”Objective: remove page-depth amplification from cross-shard fan-out.
Option A (recommended first): Cursor pagination with k-way merge
Section titled “Option A (recommended first): Cursor pagination with k-way merge”- Introduce cursor-based list contracts for publications and people endpoints.
- Query each shard with per-shard cursor and fixed shard page window.
- Merge sorted shard streams using k-way merge, emit next cursor.
- Keep legacy page/perPage endpoints temporarily behind compatibility adapter.
Option B (later if needed): Aggregation index table
Section titled “Option B (later if needed): Aggregation index table”- Build a denormalized listing index per workspace keyed by sortable fields.
- Read list endpoints primarily from index table.
- Keep source-of-truth writes in primary tables.
Acceptance criteria
Section titled “Acceptance criteria”- endpoint complexity no longer grows with requested page depth
- deep navigation (equivalent of page 50+) remains within SLO
- response ordering is stable and deterministic
Rollback strategy
Section titled “Rollback strategy”- keep legacy pagination path behind feature flag
- per-route switch to old path if cursor path degrades
Phase 3: 100-Language Frontend i18n Architecture (Week 4 to 6)
Section titled “Phase 3: 100-Language Frontend i18n Architecture (Week 4 to 6)”Objective: remove static-locale assumptions and keep bundle growth controlled.
dashboard i18n runtime
Section titled “dashboard i18n runtime”- Replace static locale imports with lazy loading by locale + namespace.
- Preload only fallback locale on boot.
- Add route-level namespace loading for heavy sections.
- Introduce locale registry (from config/API), not hardcoded array.
UI and forms
Section titled “UI and forms”- Refactor localized inputs from fixed tabs (en/pt) to dynamic language selector.
- Add search/filter in language selector for large locale sets.
- Add clear fallback indicator when value shown is from fallback locale.
Routing and locale handling
Section titled “Routing and locale handling”- Expand locale normalization to support full BCP-47 tags where needed.
- Keep canonical URL policy (default locale path elision) with explicit redirects.
Acceptance criteria
Section titled “Acceptance criteria”- initial JS bundle increase from adding 98 locales stays under 10%
- locale switch to uncached locale renders in under 500ms p95
- no hardcoded en/pt assumptions in runtime code paths
Phase 4: Multi-Language Data And Search (Week 6 to 9)
Section titled “Phase 4: Multi-Language Data And Search (Week 6 to 9)”Objective: make content search and fallback truly locale-aware.
Data model and indexing
Section titled “Data model and indexing”- Introduce searchable projection layer for localized fields:
- localized search table per entity-language OR
- FTS table with language-tagged entries
- Populate projection asynchronously from writes/ingestion updates.
- Add migration scripts and backfill jobs for existing records.
API changes
Section titled “API changes”- Add locale and fallback parameters to list/search endpoints.
- Rank matches by requested locale first, then fallback chain.
- Return metadata:
- matched_locale
- fallback_used boolean
Acceptance criteria
Section titled “Acceptance criteria”- searching in non-English locale returns expected records
- search latency remains within SLO under full dataset
- fallback semantics are deterministic and documented
Phase 5: Translation Operations, QA, And Rollout (Week 8 to 10)
Section titled “Phase 5: Translation Operations, QA, And Rollout (Week 8 to 10)”Objective: operationalize 100-language support safely.
Operations
Section titled “Operations”- Define translation source of truth and sync pipeline.
- Add missing-key detection in CI for all namespaces.
- Add pseudo-locale in QA for overflow/truncation checks.
- Add translation freeze + release checklist.
QA matrix
Section titled “QA matrix”- Tier-1 locales: full regression on each release.
- Tier-2 locales: sampled smoke coverage.
- RTL validation plan (if/when RTL locales are enabled).
Rollout strategy
Section titled “Rollout strategy”- Feature-flag locale cohorts (10 -> 25 -> 50 -> 100).
- Monitor error rates, missing key rates, and performance per cohort.
- Auto-disable newly enabled locales if error threshold exceeded.
Acceptance criteria
Section titled “Acceptance criteria”- 100 locales enabled in production behind controlled rollout
- no severe UX regressions from text overflow in tier-1 locales
- dashboard-api and dashboard SLOs still met after full rollout
API Contract Changes Summary
Section titled “API Contract Changes Summary”Planned changes to coordinate early with consumers:
- List endpoints add cursor-based variants.
- Search endpoints accept locale context.
- Responses include locale metadata fields for transparency.
- Timeseries endpoints return canonical period keys only.
Testing Plan By Phase
Section titled “Testing Plan By Phase”- Unit tests
- locale fallback resolution
- cursor encoding/decoding and sort stability
- search ranking precedence by locale
- Integration tests
- cross-shard cursor traversal
- locale-aware search end-to-end
- cache invalidation on write paths
- Production verification
- deploy workers for worker-side changes
- verify production routes and observability dashboards
Suggested Owners
Section titled “Suggested Owners”- API performance stream: dashboard-api maintainers
- Frontend i18n stream: dashboard maintainers
- Search/index stream: shared API + data owners
- Translation ops stream: docs/product ops + frontend
Milestone Checklist
Section titled “Milestone Checklist”- M0 Baseline metrics complete
- M1 Quick wins shipped
- M2 Cursor pagination live for publications and people
- M3 Lazy-loaded i18n live with dynamic locale registry
- M4 Locale-aware search live
- M5 100-language rollout complete
Risks And Mitigations
Section titled “Risks And Mitigations”- Risk: cursor migration breaks clients
- Mitigation: dual-run old and new list contracts until parity sign-off
- Risk: i18n lazy loading introduces flash/missing text
- Mitigation: suspense fallback + namespace prefetch on route transition
- Risk: search index lag after writes
- Mitigation: write-through updates for critical fields + lag monitoring
- Risk: translation quality variance across 100 locales
- Mitigation: tiered QA and staged rollout by locale cohort
Immediate Next Actions (This Week)
Section titled “Immediate Next Actions (This Week)”- Approve Phase 0 instrumentation scope and SLO targets.
- Create implementation tickets for Phase 1 and Phase 2 design spike.
- Decide between projection-table vs FTS approach for Phase 4.
- Define locale registry source (config file vs API-managed).
Last updated: March 28, 2026