Skip to content

snapback-dev/contracts

@snapback-oss/contracts

npm version License

TypeScript types and Zod schemas for the SnapBack platform

Part of the SnapBack open-core ecosystem - automated snapshot management and file protection for developers.

Installation

npm install @snapback-oss/contracts
# or
pnpm add @snapback-oss/contracts
# or
yarn add @snapback-oss/contracts

Usage

Events

import { 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);

Types

import type { Snapshot, FileProtection } from '@snapback-oss/contracts';

const snapshot: Snapshot = {
  id: 'snap_123',
  files: [],
  createdAt: new Date(),
};

Session Management

import { generateSessionId, validateSession } from '@snapback-oss/contracts';

const sessionId = generateSessionId();

What's Included

Public API (OSS)

  • ✅ Event types and schemas
  • ✅ Snapshot types
  • ✅ Session management
  • ✅ ID generation utilities
  • ✅ Validation helpers

Not Included (Proprietary)

  • ❌ Subscription/tier types
  • ❌ Dashboard schemas
  • ❌ Analytics events
  • ❌ Payment integration types

Architecture

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.

Contributing

We welcome contributions! See CONTRIBUTING.md for guidelines.

Development

# 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

Links

Related Packages

License

Apache-2.0 © SnapBack

Support

About

Open source contracts package for SnapBack

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published