learning_ai_notes/docs/roadmaps/09_BACKEND_REUSE_ALIGNMENT_ROADMAP.md
2026-03-10 11:59:12 -07:00

3.1 KiB

Backend Reuse Alignment Roadmap

Status: Draft Parent: docs/ARCHITECTURE_REVIEW_AND_REUSE_ROADMAP.md Scope: backend/

Goal

Keep the backend strongly product-specific for notes domain logic while maximizing reuse of ByteLyst shared packages and avoiding premature extraction of notes-specific code into common platform layers.

Preserve As Product-Local

  • notes module remains local
  • workspaces module remains local
  • note-relationships module remains local
  • note-tasks module remains local
  • note-artifacts module remains local
  • note-agent-actions module remains local

Shared Package Alignment

  • Continue using @bytelyst/auth
  • Continue using @bytelyst/config
  • Continue using @bytelyst/cosmos
  • Continue using @bytelyst/datastore
  • Continue using @bytelyst/errors
  • Continue using @bytelyst/fastify-core
  • Continue using @bytelyst/logger
  • Continue using @bytelyst/testing

Dependency Notes

  • Finalize backend contract decisions before broad web/mobile DTO cleanup
  • Use this roadmap to define what must stay local before proposing any common-plat extraction
  • Coordinate blob/extraction/MCP decisions with the platform/shared-services roadmap

Phase B0 — Identity and Config Alignment

  • Keep shared/product.json as the backend identity source
  • Ensure all persisted docs use the canonical product identity field
  • Review backend env schema for any duplicated or drifting product constants
  • Keep service URLs explicit for platform/extraction/MCP dependencies

Phase B1 — Shared-Service Boundary Discipline

  • Confirm no platform-service concern is being reimplemented locally
  • Keep auth/identity concerns delegated to shared platform patterns
  • Keep extraction logic delegated to extraction-service
  • Keep blob authorization/upload patterns delegated to shared blob/platform flows
  • Keep MCP orchestration compatible with shared mcp-server

Phase B2 — Contract and DTO Hygiene

  • Review backend response shapes used by web/mobile
  • Identify DTO duplication across backend/web/mobile
  • Introduce a repo-local shared contracts layer only if duplication becomes costly
  • Do not move notes-specific contracts to common platform unless another product clearly needs them

Phase B3 — Hardening

  • Add route behavior tests using Fastify inject()
  • Add repository behavior tests
  • Add cross-entity tests for notes + relationships/tasks/artifacts/agent actions
  • Review request tracing and error behavior against workspace standards
  • Replace raw stdout/stderr startup output with shared logger patterns if practical

Guardrails

  • Do not move notes-specific modules into platform-service
  • Do not create shared abstractions that only benefit this one product
  • Do not over-generalize the notes domain into common platform prematurely

Done When

  • backend remains clearly product-specific
  • shared package usage is explicit and clean
  • backend contracts are stable enough for web/mobile integration
  • backend quality is improved without architectural drift