Shared domain models and types for the Synchro application ecosystem.
This package provides centralized, typed domain models used across:
- Client (Next.js frontend)
- Backend (Express API)
- SDK (TypeScript SDK)
By centralizing these types, we:
- Prevent type drift between layers
- Reduce duplication and maintenance burden
- Eliminate ad-hoc type casts
- Ensure consistent data contracts
# In client, backend, or sdk directories
npm install ../sharedimport {
Subscription,
CreateSubscriptionInput,
Payment,
UserProfile
} from '@syncro/shared';
// Use in your code with full type safety
const subscription: Subscription = {
id: '123',
userId: 'user-456',
name: 'Netflix',
// ... other fields
};This package follows semantic versioning:
-
Major version (1.x.x → 2.x.x): Breaking changes to domain models
- Removing fields
- Changing field types incompatibly
- Renaming fields
-
Minor version (x.1.x → x.2.x): Backwards-compatible additions
- Adding new optional fields
- Adding new types
- Extending enums
-
Patch version (x.x.1 → x.x.2): Non-breaking fixes
- Documentation updates
- Type refinements that don't break existing code
# Build the package
npm run build
# Watch for changes during development
npm run watchWhen migrating existing code to use shared types:
- Install the package in your workspace
- Replace local type definitions with imports from
@syncro/shared - Update any transformation functions to use the shared types
- Run type checking to catch any mismatches
- Update tests to use shared types
When adding or modifying types:
- Consider backwards compatibility
- Update version according to semver rules
- Document breaking changes in CHANGELOG
- Update dependent packages (client, backend, sdk)