Problem Statement
Types are duplicated across SDK, app, and API layers:
xstreamroll-sdk/src/types.ts — Stream, StreamEvent, AuthTokens, etc.
app/lib/api/tags.ts — Tag, PagedTags
app/lib/api/admin-stats.ts — AdminStats
app/lib/api/notifications.ts — Notification
api/src/streams/stream.entity.ts — Stream
api/src/tags/tag.entity.ts — Tag
A change to Stream structure requires updates in 3+ files across 3 packages.
Evidence
Type definitions for Tag, Stream, PaginationParams, etc. exist independently in SDK, API, and app.
Impact
Type drift between packages. If the API changes a field, the SDK and app types may go out of sync silently. High maintenance overhead for any schema change.
Proposed Solution
Extract shared types into a new packages/types/ (or @xstreamroll/types) package:
packages/types/src/stream.ts
packages/types/src/auth.ts
packages/types/src/tag.ts
packages/types/src/pagination.ts
packages/types/src/errors.ts
All three consuming packages import from @xstreamroll/types.
Acceptance Criteria
File Map
packages/types/package.json — new
packages/types/src/*.ts — new type files
packages/types/tsconfig.json — new
root package.json — add workspace
xstreamroll-sdk/src/types.ts — replace with re-exports
app/lib/api/*.ts — import from @xstreamroll/types
Dependencies
- Blocked by: Requires monorepo workspace configuration
Labels: dx, refactoring
Priority: Medium | Difficulty: Advanced | Estimated Effort: 2d
Labels: dx,refactoring
Priority: Medium | Difficulty: Advanced | Estimated Effort: 2d
Backlog ID: REPO-023
Problem Statement
Types are duplicated across SDK, app, and API layers:
xstreamroll-sdk/src/types.ts— Stream, StreamEvent, AuthTokens, etc.app/lib/api/tags.ts— Tag, PagedTagsapp/lib/api/admin-stats.ts— AdminStatsapp/lib/api/notifications.ts— Notificationapi/src/streams/stream.entity.ts— Streamapi/src/tags/tag.entity.ts— TagA change to Stream structure requires updates in 3+ files across 3 packages.
Evidence
Type definitions for
Tag,Stream,PaginationParams, etc. exist independently in SDK, API, and app.Impact
Type drift between packages. If the API changes a field, the SDK and app types may go out of sync silently. High maintenance overhead for any schema change.
Proposed Solution
Extract shared types into a new
packages/types/(or@xstreamroll/types) package:packages/types/src/stream.tspackages/types/src/auth.tspackages/types/src/tag.tspackages/types/src/pagination.tspackages/types/src/errors.tsAll three consuming packages import from
@xstreamroll/types.Acceptance Criteria
File Map
packages/types/package.json— newpackages/types/src/*.ts— new type filespackages/types/tsconfig.json— newroot package.json— add workspacexstreamroll-sdk/src/types.ts— replace with re-exportsapp/lib/api/*.ts— import from @xstreamroll/typesDependencies
Labels: dx, refactoring
Priority: Medium | Difficulty: Advanced | Estimated Effort: 2d
Labels: dx,refactoring
Priority: Medium | Difficulty: Advanced | Estimated Effort: 2d
Backlog ID: REPO-023