You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description
Right now, types like Issue, User, Event, and API response shapes are either duplicated across the mobile app and backend, or don't exist on the frontend at all. This issue sets up the shared/ directory as a proper TypeScript package that both backend/ and mobile/ (and eventually web/) can import from.
Purpose
A single source of truth for types eliminates a whole class of bugs. When a developer changes Issue.cityRefNumber to Issue.cityReferenceNumber, TypeScript will immediately surface every broken call site across the entire monorepo, instead of discovering it at runtime.
Requirements
Initialize shared/ as a TypeScript package (package.json, tsconfig.json)
Then in the monorepo root run npm install to symlink it.
Keep shared types minimal: only put types here that are truly shared. Backend-only types (Prisma internals, middleware types) stay in backend/. Screen prop types stay in mobile/.
Don't duplicate Prisma: the backend's Prisma client already generates types. The shared types should mirror the API surface (what gets sent over the wire), not the database schema. They'll be similar but not identical (e.g., no passwordHash on the shared User type).
Enums as string unions: prefer type IssueStatus = 'OPEN' | 'IN_PROGRESS' | 'RESOLVED' over TypeScript enum for better JSON serialization compatibility with React Native.
// Usage in backend controller
import { CreateIssueRequest, ApiResponse, Issue } from '@civickit/shared';
// Usage in mobile screen
import { Issue, IssueStatus } from '@civickit/shared';
Description
Right now, types like Issue, User, Event, and API response shapes are either duplicated across the mobile app and backend, or don't exist on the frontend at all. This issue sets up the shared/ directory as a proper TypeScript package that both backend/ and mobile/ (and eventually web/) can import from.
Purpose
A single source of truth for types eliminates a whole class of bugs. When a developer changes Issue.cityRefNumber to Issue.cityReferenceNumber, TypeScript will immediately surface every broken call site across the entire monorepo, instead of discovering it at runtime.
Requirements
Acceptance Criteria
Tech Notes
Then in the monorepo root run
npm installto symlink it.Keep shared types minimal: only put types here that are truly shared. Backend-only types (Prisma internals, middleware types) stay in
backend/. Screen prop types stay inmobile/.Don't duplicate Prisma: the backend's Prisma client already generates types. The shared types should mirror the API surface (what gets sent over the wire), not the database schema. They'll be similar but not identical (e.g., no
passwordHashon the sharedUsertype).Enums as string unions: prefer
type IssueStatus = 'OPEN' | 'IN_PROGRESS' | 'RESOLVED'over TypeScriptenumfor better JSON serialization compatibility with React Native.Suggested File Structure
shared/package-json: (should be autogenerated by
npm install)Example Code
Helpful Resources
Coding Journal Prompts