Skip to content

Introduction

jsorm is a JSON-first ORM for TypeScript focused on clarity, strong typing, and explicit SQL behavior.

  • JSON-first queries instead of opaque builder chains
  • AST-based SQL generation so internal structure stays inspectable
  • Type inference from models so defineModel() becomes the single source of truth
  • Explicit relation builders for predictable joins and mutations
  • Optional migrations so existing databases can be used immediately

You describe intent with plain objects:

const users = await db.get(User, {
select: {
id: true,
name: true,
role: { name: true },
},
where: {
active: true,
},
});

The ORM turns that into a structured AST and then emits SQL through the configured adapter.

  • TypeScript backends that want model-driven inference
  • teams that prefer explicit SQL semantics over magic
  • services using PostgreSQL, MySQL, or SQLite
  • apps that want raw SQL access without losing a higher-level API
  1. Treat model definitions as the single source of truth.
  2. Keep query payloads readable and close to business intent.
  3. Use executeSql() for truly custom statements, not as the default path.
  4. Keep adapter configuration centralized in one connection module.