data-table- Typed relational query toolkit with ORM capabilitiesdata-schema- Runtime validation and coercion for data schemas
Features
data-table
- One API Across Databases: Same query and relation APIs across PostgreSQL, MySQL, and SQLite adapters
- Two Complementary Query Styles: Chainable query builder for advanced queries or high-level database helpers for common CRUD
- Type-Safe Reads: Typed
select, relation loading, and predicate keys - Optional Runtime Validation: Add
validate(context)at the table level for create/update validation and coercion - Relation-First Queries:
hasMany,hasOne,belongsTo,hasManyThrough, and nested eager loading - Safe Scoped Writes:
update/deletewithorderBy/limitrun safely in a transaction - First-Class Migrations: Up/down migrations with schema builders, runner controls, and dry-run planning
- Raw SQL Escape Hatch: Execute SQL directly with
db.exec(sql…)
data-schema
- Standard Schema v1 Compatible: Works with any Standard Schema-compatible library
- Sync-First: Minimal API surface with synchronous validation
- Runtime Validation: Validate and coerce data at runtime with custom error messages
- Composable Checks: Reusable validation rules with
.pipe()and.refine()
Installation
Quick Start
Define Tables
Query Builder
Usedb.query(table) for joins, custom shape selection, eager loading, or aggregate logic:
CRUD Helpers
For common operations, use the simplified CRUD helpers:Validation with data-schema
Integrate runtime validation into your tables:Type Safety
Both packages are fully typed:Next Steps
- Schema Validation - Learn about runtime validation with data-schema
- Database Queries - Master the query builder and CRUD helpers
- Migrations - Set up and manage database migrations
- Relations - Work with table relationships and eager loading