OpenSya Persistence

The persistence engine built for OpenSya.

Declare the domain once. Persistence executes validation, relations, lifecycle hooks, transactions, audit trails and domain events consistently, while the database remains behind an adapter.

Getting started
Define a typed table and execute your first PostgreSQL query.
Metadata and inference
Model tables once and infer every returned entity automatically.
Query Engine
Read and mutate data through the validated execution runtime.

Runtime features

Validation
Structural, field and cross-field rules.
Relations
Explicit batched population for every cardinality.
Field visibility
Keep secrets and contextual fields out of results.
Audit Log
Record transactional before/after snapshots and changes.
Domain Events
Persist typed events atomically and publish them safely.
Cursor pagination
Stable keyset pagination without OFFSET.

What it owns

  • a typed metadata registry and schema validation;
  • a database-independent query model;
  • inferred result types from table metadata;
  • safe, transactional mutations and lifecycle hooks;
  • explicit relation population and result serialization;
  • transactional audit logs and domain-event outboxes;
  • PostgreSQL execution and introspection through Drizzle.
Persistence does not generate migrations and does not replace Drizzle. It gives OpenSya one runtime for executing domain rules around database operations.