v0.1

Database layer for
TypeScript backends

Define your schema once. Query with full type safety, swap databases freely, and extend with plugins — without adopting a full framework.

View on GitHub
$npm install @datrix/core

See it in action

Real queries, real output. Browse CRUD operations and explore how Datrix handles relations, filters, and nested queries.

Querycreate
datrix.create("tag", {
    name: "GraphQL",
    color: "#E10098"
  })
Schematag
namestringrequired
colorstring
Outputtag
{
  "id": 6,
  "name": "GraphQL",
  "color": "#E10098",
  "createdAt": "2026-04-06T22:19:27.505Z",
  "updatedAt": "2026-04-06T22:19:27.505Z"
}

Everything you need, nothing you don't

Datrix is a minimal, type-safe database framework designed to integrate into your existing stack — not replace it.

Fully Typed

Schema types generated via CLI. Full IntelliSense and compile-time safety across queries, relations, and plugins.

Adapter System

Swap databases without touching your business logic. Each adapter handles query translation, migrations, and relation population independently.

PostgreSQL

Full query translation, relations, migrations.

MySQL

MySQL & MariaDB support.

MongoDB

Full CRUD, population, migration support.

JSON

File-based adapter for local dev & testing.

CLI Tooling

Everything from the terminal — migrations, type generation, and resource scaffolding.

$datrix migrate# run pending migrations
$datrix generate types# generate TS types
$datrix generate schema User# scaffold schema
$datrix dev# watch & auto-migrate

API Plugin

Drop in the API plugin to get a full REST layer — authentication, permissions, and query parsing included.

REST Endpoints

Auto-generated CRUD routes for every schema.

Auth (optional)

JWT & session, register/login/logout/me built-in.

Permissions

Role-based access control per route and schema.

Query Parsing

Filter, populate, sort, paginate via URL params.

Plugin Architecture

Extend core through a structured plugin system. REST API, file uploads — only add what you need.

Migration System

Schema changes tracked and applied through versioned migrations managed entirely via CLI.

Zero Lock-in

Datrix integrates into your existing stack. No framework takeover, no opinionated project structure.

Works with your stack

Datrix is framework-agnostic. Use it with any TypeScript backend — no lock-in.

Next.jsFull-stack React framework
ExpressMinimal Node.js server
FastifyFast & low overhead
NestJSModular & typed backend
HonoEdge-ready web framework
BunRuntime & toolkit
ElysiaBun-native framework
RemixFull-stack web framework
Next.jsFull-stack React framework
ExpressMinimal Node.js server
FastifyFast & low overhead
NestJSModular & typed backend
HonoEdge-ready web framework
BunRuntime & toolkit
ElysiaBun-native framework
RemixFull-stack web framework
Next.jsFull-stack React framework
ExpressMinimal Node.js server
FastifyFast & low overhead
NestJSModular & typed backend
HonoEdge-ready web framework
BunRuntime & toolkit
ElysiaBun-native framework
RemixFull-stack web framework