open-index/open-npm huggingface dataset:
npm package: @qbk/mercadopago-medusa-storefront
Description: This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
Latest version: 0.0.1

# React + TypeScript + Vite

This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.

Currently, two official plugins are available:

- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react) uses [Babel](https://babeljs.io/) (or [oxc](https://oxc.rs) when used in [rolldown-vite](https://vite.dev/guide/rolldown)) for Fast Refresh
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh

## React Compiler

The React Compiler is not enabled on this template because of its impact on dev & build performances. To add it, see [this documentation](https://react.dev/learn/react-compiler/installation).

## Expanding the ESLint configuration

If you are developing a production application, we recommend updating the configuration to enable type-aware lint rules:

```js
export default defineConfig([
  globalIgnores(['dist']),
  {
    files: ['**/*.{ts,tsx}'],
    extends: [
      // Other configs...

      // Remove tseslint.configs.recommended and replace with this
      tseslint.configs.recommendedTypeChecked,
      // Alternatively, use this for stricter rules
      tseslint.configs.strictTypeChecked,
      // Optionally, add this for stylistic rules
      tseslint.configs.stylisticTypeChecked,

      // Other configs...
    ],
    languageOptions: {
      parserOptions: {
        project: ['./tsconfig.node.json', './tsconfig.app.json'],
        tsconfigRootDir: import.meta.dirname,
      },
      // other options...
    },
  },
])
```

You can also install [eslint-plugin-react-x](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-x) and [eslint-plugin-react-dom](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-dom) for React-specific lint rules:

```js
// eslint.config.js
import reactX from 'eslint-plugin-react-x'
import reactDom from 'eslint-plugin-react-dom'

export default defineConfig([
  globalIgnores(['dist']),
  {
    files: ['**/*.{ts,tsx}'],
    extends: [
      // Other configs...
      // Enable lint rules for React
      reactX.configs['recommended-typescript'],
      // Enable lint rules for React DOM
      reactDom.configs.recommended,
    ],
    languageOptions: {
      parserOptions: {
        project: ['./tsconfig.node.json', './tsconfig.app.json'],
        tsconfigRootDir: import.meta.dirname,
      },
      // other options...
    },
  },
])
```
npm package: @qbobjx/codegen
Description: Code generation tooling for OBJX: introspection, model generation, migration templates, and seed templates.
Latest version: 0.3.0

# @qbobjx/codegen

Code generation tooling for OBJX: introspection, model generation, migration templates, and seed templates.

## Install

```bash
npm install -D @qbobjx/codegen
```

## CLI

```bash
npx objx-codegen --help
```
npm package: @qbobjx/core
Description: Core runtime for OBJX: model metadata, columns, relations, typed query builder, and execution context contracts.
Latest version: 0.3.0

# @qbobjx/core

Core runtime for OBJX: model metadata, columns, relations, typed query builder, and execution context contracts.

## Install

```bash
npm install @qbobjx/core
```

## Quick Usage

```ts
import { col, defineModel } from '@qbobjx/core';

export const Project = defineModel({
  table: 'projects',
  columns: {
    id: col.int().primary(),
    name: col.text(),
    tenantId: col.text().generated(),
  },
});
```

## Plugin Authoring

`@qbobjx/core` also exports the public plugin contracts used by official and custom plugins.

```ts
import { definePlugin } from '@qbobjx/core';

export const snakeCasePlugin = definePlugin({
  name: 'snake-case-naming',
  hooks: {
    onModelDefine(context) {
      context.setColumnDbName('tenantId', 'tenant_id');
      context.setColumnDbName('createdAt', 'created_at');
    },
  },
});
```

`onModelDefine` runs during `defineModel(...)` after column inputs are resolved and before the final model metadata is frozen. Use it to inspect `columnDefinitions`, read existing `dbName` mappings with `getColumnDbName(...)`, or apply naming conventions with `setColumnDbName(...)`.
npm package: @qbobjx/mysql-driver
Description: Official MySQL driver/session package for OBJX.
Latest version: 0.3.0

# @qbobjx/mysql-driver

Official MySQL driver/session package for OBJX.

## Install

```bash
npm install @qbobjx/mysql-driver @qbobjx/sql-engine @qbobjx/core mysql2
```

## Quick Usage

```ts
import mysql from 'mysql2/promise';
import { createMySqlSession } from '@qbobjx/mysql-driver';

const pool = mysql.createPool({ uri: process.env.DATABASE_URL });
const session = createMySqlSession({ pool });
```
npm package: @qbobjx/nestjs
Description: Official NestJS integration for OBJX.
Latest version: 0.3.0

# @qbobjx/nestjs

Official NestJS integration for OBJX.

## Install

```bash
npm install @qbobjx/nestjs @nestjs/common @nestjs/core rxjs
```

Add your driver and core packages as needed, for example:

```bash
npm install @qbobjx/core @qbobjx/sqlite-driver @qbobjx/plugins
```

## What You Get

- `ObjxModule.forRoot(...)`
- `ObjxModule.forRootAsync(...)`
- session injection token and `@InjectObjxSession()` helper
- `ObjxSessionHost<TSession>` service for a typed session host without custom decorators everywhere
- `InferObjxSession<typeof yourFactory>` helper type
- optional request-scoped execution context middleware/interceptor
- global exception filter support for OBJX validation errors

## Quick Usage

```ts
import { Module } from '@nestjs/common';
import { ObjxModule } from '@qbobjx/nestjs';

@Module({
  imports: [
    ObjxModule.forRootAsync({
      global: true,
      useFactory: async () => ({
        session: createSessionSomehow(),
      }),
    }),
  ],
})
export class AppModule {}
```

## Recommended Typing Pattern

If you do not want `ReturnType<typeof createSqliteSession>` repeated across services, infer the
session type once from your module options factory and inject `ObjxSessionHost<TSession>`:

```ts
import { Injectable } from '@nestjs/common';
import { InferObjxSession, ObjxSessionHost } from '@qbobjx/nestjs';

export function createObjxNestModuleOptions() {
  return {
    session: createSessionSomehow(),
  };
}

export type AppObjxSession = InferObjxSession<typeof createObjxNestModuleOptions>;

@Injectable()
export class ProjectsService {
  constructor(private readonly objx: ObjxSessionHost<AppObjxSession>) {}

  listProjects() {
    return this.objx.session.execute(Project.query());
  }
}
```

Use `@InjectObjxSession()` when you only want the bare session. Use `ObjxSessionHost<TSession>` when
you want the typed session plus helper access to the current execution context.

## Postgres RLS With Request Context

If your NestJS app uses PostgreSQL RLS with `current_setting(...)`, configure the Postgres session
to project request-context values into `set_config(...)` at transaction start:

```ts
import { createExecutionContextManager } from '@qbobjx/core';
import { createPostgresSession } from '@qbobjx/postgres-driver';

const executionContextManager = createExecutionContextManager();

const session = createPostgresSession({
  pool,
  executionContextManager,
  executionContextSettings: {
    bindings: [
      { setting: 'app.tenant_id', contextKey: 'tenantId', required: true },
      { setting: 'app.actor_id', contextKey: 'actorId' },
    ],
  },
});
```

With `ObjxModule` request context enabled, headers like `x-tenant-id` and `x-actor-id` already flow
into the execution context. To make PostgreSQL RLS see them, run the protected work inside
`session.transaction(...)` so OBJX can apply the `set_config(...)` bindings on the same connection.
npm package: @qbobjx/plugins
Description: Official OBJX plugins, including timestamps, snake case naming, soft delete, tenant scope, and audit trail.
Latest version: 0.3.0

# @qbobjx/plugins

Official OBJX plugins, including timestamps, snake case naming, soft delete, tenant scope, and audit trail.

## Install

```bash
npm install @qbobjx/plugins
```

## Quick Usage

```ts
import { col, defineModel } from '@qbobjx/core';
import {
  createSnakeCaseNamingPlugin,
  createSoftDeletePlugin,
  createTenantScopePlugin,
} from '@qbobjx/plugins';

export const Account = defineModel({
  table: 'accounts',
  columns: {
    id: col.int().primary(),
    tenantId: col.text(),
    deletedAt: col.timestamp().nullable(),
  },
  plugins: [
    createSnakeCaseNamingPlugin(),
    createTenantScopePlugin(),
    createSoftDeletePlugin(),
  ],
});
```

## Included Plugins

- `createTimestampsPlugin()`
- `createSnakeCaseNamingPlugin()`
- `createSoftDeletePlugin()`
- `createTenantScopePlugin()`
- `createAuditTrailPlugin()`

## Snake Case Naming

Use `createSnakeCaseNamingPlugin()` when your model keys are camelCase but your physical database columns are snake_case.

```ts
import { col, defineModel } from '@qbobjx/core';
import { createSnakeCaseNamingPlugin } from '@qbobjx/plugins';

export const Account = defineModel({
  table: 'accounts',
  columns: {
    id: col.int().primary(),
    tenantId: col.text(),
    createdAt: col.timestamp(),
  },
  plugins: [
    createSnakeCaseNamingPlugin({
      exclude: ['id'],
      overrides: {
        createdAt: 'created_on',
      },
    }),
  ],
});
```

The compiler emits physical names like `tenant_id`, while hydrated rows continue to use model keys like `tenantId`.

Important: this plugin should be attached at model definition time. It updates column metadata in
the `onModelDefine` hook, so adding it only as a session-global plugin is too late for remapping.

Repository examples using this pattern:

- `examples/complex-runtime`
- `examples/express-api`
- `examples/nestjs-api`

## Tenant Scope Vs PostgreSQL RLS

`createTenantScopePlugin()` injects tenant predicates into OBJX-generated SQL. It does not replace
PostgreSQL RLS policies that depend on `set_config(...)` / `current_setting(...)`.

If your database enforces tenant isolation through PostgreSQL RLS, configure
`createPostgresSession({ executionContextSettings: ... })` in `@qbobjx/postgres-driver` and execute
protected work inside `session.transaction(...)`.
npm package: @qbobjx/postgres-driver
Description: Official Postgres driver/session package for OBJX.
Latest version: 0.3.0

# @qbobjx/postgres-driver

Official Postgres driver/session package for OBJX.

## Install

```bash
npm install @qbobjx/postgres-driver @qbobjx/sql-engine @qbobjx/core pg
```

## Quick Usage

```ts
import { Pool } from 'pg';
import { createPostgresSession } from '@qbobjx/postgres-driver';

const pool = new Pool({ connectionString: process.env.DATABASE_URL });
const session = createPostgresSession({ pool });
```

## Execution Context Settings For RLS

If your PostgreSQL policies depend on `current_setting(...)`, you can map `ExecutionContext`
values into `set_config(...)` automatically at the start of every OBJX transaction:

```ts
import { createExecutionContextManager } from '@qbobjx/core';
import { createPostgresSession } from '@qbobjx/postgres-driver';

const executionContextManager = createExecutionContextManager();

const session = createPostgresSession({
  pool,
  executionContextManager,
  executionContextSettings: {
    bindings: [
      { setting: 'app.tenant_id', contextKey: 'tenantId', required: true },
      { setting: 'app.actor_id', contextKey: 'actorId' },
    ],
  },
});

await executionContextManager.run(
  {
    values: {
      tenantId: 'tenant_a',
      actorId: 'user_123',
    },
  },
  () =>
    session.transaction(async (transactionSession) => {
      await transactionSession.execute(Project.query());
    }),
);
```

Important: with pooled PostgreSQL connections this is intentionally applied inside
`session.transaction(...)`, where OBJX can guarantee the `set_config(...)` calls and the protected
queries use the same physical connection.
npm package: @qbobjx/sql-engine
Description: Embedded SQL engine for OBJX: SQL compilation, execution session contracts, and raw SQL helpers.
Latest version: 0.3.0

# @qbobjx/sql-engine

Embedded SQL engine for OBJX: SQL compilation, execution session contracts, and raw SQL helpers.

## Install

```bash
npm install @qbobjx/sql-engine
```

## Quick Usage

```ts
import { identifier, sql } from '@qbobjx/sql-engine';

const query = sql`select * from ${identifier('projects')}`;
```

## Model Column Names

When a model column is configured with `dbName`, `@qbobjx/sql-engine` compiles SQL against the physical column name and aliases full-model selections back to the logical model key.

```ts
import { col, defineModel } from '@qbobjx/core';
import { ObjxSqlCompiler } from '@qbobjx/sql-engine';

const Account = defineModel({
  table: 'accounts',
  columns: {
    id: col.int().primary(),
    tenantId: col.text().configure({ dbName: 'tenant_id' }),
  },
});

const compiled = new ObjxSqlCompiler({ dialect: 'sqlite3' }).compile(
  Account.query().where(({ tenantId }, op) => op.eq(tenantId, 'tenant_a')),
);
```

The generated SQL uses `tenant_id` in predicates and result selection, while keeping `tenantId` as the logical field name exposed by the model.
npm package: @qbobjx/sqlite-driver
Description: Official SQLite driver/session package for OBJX.
Latest version: 0.3.0

# @qbobjx/sqlite-driver

Official SQLite driver/session package for OBJX.

## Install

```bash
npm install @qbobjx/sqlite-driver @qbobjx/sql-engine @qbobjx/core
```

## Quick Usage

```ts
import { createSqliteSession } from '@qbobjx/sqlite-driver';

const session = createSqliteSession({
  databasePath: './app.sqlite',
});
```
npm package: @qbobjx/validation
Description: Validation contracts and official adapters used by OBJX model validation flows.
Latest version: 0.3.0

# @qbobjx/validation

Validation contracts and official adapters used by OBJX model validation flows.

## Install

```bash
npm install @qbobjx/validation
```

## Notes

This package is used by runtime integrations to validate payloads with supported adapters.