TypeScript types and Zod schemas for the SnapBack platform
Part of the SnapBack open-core ecosystem - automated snapshot management and file protection for developers.
npm install @snapback-oss/contracts
# or
pnpm add @snapback-oss/contracts
# or
yarn add @snapback-oss/contractsimport { SnapshotCreatedEvent, validateEvent } from '@snapback-oss/contracts';
// Type-safe event handling
const event: SnapshotCreatedEvent = {
type: 'snapshot.created',
payload: {
snapshotId: 'snap_123',
timestamp: Date.now(),
},
};
// Validate with Zod
const result = validateEvent(event);import type { Snapshot, FileProtection } from '@snapback-oss/contracts';
const snapshot: Snapshot = {
id: 'snap_123',
files: [],
createdAt: new Date(),
};import { generateSessionId, validateSession } from '@snapback-oss/contracts';
const sessionId = generateSessionId();- ✅ Event types and schemas
- ✅ Snapshot types
- ✅ Session management
- ✅ ID generation utilities
- ✅ Validation helpers
- ❌ Subscription/tier types
- ❌ Dashboard schemas
- ❌ Analytics events
- ❌ Payment integration types
This package is part of SnapBack's open-core model:
- This repo (
@snapback-oss/contracts): Core types safe for public use - Private repo: Full platform including business logic
Changes to this package are automatically synced from the main SnapBack monorepo.
We welcome contributions! See CONTRIBUTING.md for guidelines.
# Clone this repository
git clone https://github.com/snapback-dev/contracts.git
# Install dependencies
pnpm install
# Build
pnpm build
# Run tests
pnpm test
# Type check
pnpm typecheck- Main Repository: Marcelle-Labs/snapback.dev (private source)
- Documentation: docs.snapback.dev
- Website: snapback.dev
- NPM: @snapback-oss/contracts
@snapback-oss/sdk- Client SDK@snapback-oss/infrastructure- Logging & tracing@snapback-oss/events- Event bus
Apache-2.0 © SnapBack