@revisium/engine
v0.6.2
Published
Revisium version engine — core versioning logic for branches, revisions, tables, and rows
Readme
@revisium/engine
Git-like version control engine for structured data.
What is this?
A NestJS module library that provides Git-like versioning for structured data: branches, revisions, tables, rows, JSON Schema validation, diffs, formula plugins, and migrations.
Extracted from @revisium/core. No auth, no billing, no API controllers — pure versioning engine.
Usage
import { EngineModule, EngineApiService } from '@revisium/engine';
@Module({ imports: [EngineModule.forRoot()] })
export class AppModule {}
@Injectable()
export class MyService {
constructor(private readonly engine: EngineApiService) {}
async example() {
await this.engine.createTable({ revisionId, tableId: 'products', schema });
await this.engine.createRow({ revisionId, tableId, rowId, data });
await this.engine.getRows({ revisionId, tableId, first: 100 });
await this.engine.createRevision({ projectId, branchName, comment });
await this.engine.revisionChanges({ revisionId });
await this.engine.cleanOrphanedData();
}
}With file storage
Provide your own IStorageService implementation (S3, local filesystem, etc.):
import { EngineModule, IStorageService } from '@revisium/engine';
const myStorage: IStorageService = {
isAvailable: true,
canServeFiles: false,
uploadFile: (file, path) => s3Client.upload(file, path),
getPublicUrl: (key) => `https://cdn.example.com/${key}`,
};
@Module({ imports: [EngineModule.forRoot({ storage: myStorage })] })
export class AppModule {}Without a storage provider, file operations throw "Storage is not configured".
Data Model
Branch (projectId: string)
└── Revision (head, draft, start)
└── Table (schema: JSON Schema)
└── Row (data: JSON, hash, meta)Documentation
- API Reference — all
EngineApiServicemethods with inputs/outputs - Integration Guide — how to use in your NestJS app
- Versioning System — data model, copy-on-write, commit/revert, invariants
Development
npm ci
docker compose -f docker/docker-compose.yml up -d
cp .env.example .env
npm run prisma:generate
npm run start:dev| Script | Description |
| ----------------- | ----------------------- |
| npm run tsc | Type check |
| npm run lint:ci | ESLint (0 warnings) |
| npm test | Run tests (1100+ tests) |
| npm run build | Production build |
Tech Stack
NestJS 11, TypeScript 5.9, PostgreSQL 17, Prisma 7, CQRS, Jest + SWC, ESLint 9, SonarQube
