Skip to content

Naming strategy

JSORM uses a configurable naming strategy to translate between TypeScript and the database.

import { defineConfig } from "@jsorm/core";
export default defineConfig({
models: "src/models",
databases: {
main: {
access: "server",
provider: "postgres-node",
options: {
naming: { fields: "snake_case" },
},
},
},
});
naming.fields JS property DB column
camelCase (default) emailVerified emailVerified
snake_case emailVerified email_verified

Table names are explicit — defined directly in defineModel().

Element Rule Examples
Models Singular User, Role, Post
Tables Plural, explicit defineModel("users", ...)
Fields camelCase createdAt, firstName
Relations camelCase role, createdBy
Databases camelCase main, cache, analytics

Providers follow the convention provider-{database}-{runtime}:

provider-sqlite-node
provider-pg-node
provider-indexeddb

SQL compilers are centralized in @jsorm/compiler (pg-node and sqlite-node delegate to it). IndexedDB keeps its own non-SQL compiler, internal to the provider.