Skip to content

Consolidate duplicated types into @repo/shared package #2

Description

@Kuses129

Summary

Response types and query param interfaces are duplicated between the frontend (apps/web/src/api/) and backend (apps/api/src/modules/), despite a shared package (@repo/shared) already existing and being wired up as a dependency of both apps.

Duplicated Types

TypeFrontendBackendOverlap
OrganizationOrganizationOrganizationResponseIdentical
RepositoryRepositoryRepositoryResponseIdentical
PullRequestPullRequestPullRequestResponse~90% (cycleTime shape differs slightly)
MergeFrequencyMergeFrequencyResponseMergeFrequencyResponseIdentical
Query ParamsPlain interfaces (e.g. PullRequestsQueryParams)class-validator DTO classes (e.g. PullRequestListQueryDto)Same shape, different runtime needs

Proposed Approach

  1. Response types — Move shared response interfaces (Organization, Repository, PullRequest, MergeFrequencyResponse, etc.) into @repo/shared and have both apps import from there.
  2. Query param interfaces — Define base interfaces in @repo/shared. The backend DTO classes should implements the shared interface while keeping their class-validator decorators for runtime validation. The frontend imports the plain interface directly.
  3. PullRequest alignment — Unify the CycleTime shape so both sides use the same definition. The backend's richer CycleTimeResponse (with breakdown fields) can extend a base CycleTime type in shared.

Current State of @repo/shared

The package infrastructure is ready (package.json, TypeScript build, exports configured, included in both app dependencies). It currently only exports:

  • HealthResponse
  • PaginatedResponse<T>
  • CursorPaginationParams

Acceptance Criteria

  • All identical response types live in @repo/shared (single source of truth)
  • Both apps/api and apps/web import these types from @repo/shared
  • No duplicated type definitions remain across apps
  • Backend DTOs implement shared interfaces for query params
  • Existing functionality unchanged (no runtime impact)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions