> ## Documentation Index
> Fetch the complete documentation index at: https://alphaconsultings.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# API Reference

> Public package and model exports with compatibility guarantees.

# Eloquent ORM JS API Reference

## Stability contract

* Only exports from `src/index.ts` are public and semver-tracked.
* The model subpath `src/Model.ts` is public and semver-tracked as `@alpha.consultings/eloquent-orm.js/Model`.
* Deep imports from `src/*` or `dist/*` internals are private.

## Root package: `@alpha.consultings/eloquent-orm.js`

### ORM Core

* `BaseModel`
* `Model`
* `SqlModel`
* `MongoModel`
* `CoreModel`
* `MorphRegistry`
* `PivotHelperMixin`

### Factories and schema

* `Factory`
* `column`
* `relation`
* `mixin`
* `validate`
* `validateSchema`
* `SchemaBuilder`
* `SchemaValidator`

### Cache and registration

* `CacheManager`
* `setupCache`
* `transaction`
* `lockedTransaction`
* `registerModels`
* `isModelRegistered`
* `setModelRegistryStrictMode`
* `isModelRegistryStrictMode`

### Types

* `ORMRecord`, `ModelAttrs`, `ModelInstance`, `TypedRelation`, `PivotRelation`
* `PlainObject`, `ModelCtor`, `FactoryCtor`, `ModelEventHooks`
* `TransactionContext`, `TransactionOptions`, `LockingOptions`
* `SqlTransaction`, `SqlTransactionDriver`, `MongoTransactionContext`
* schema and validation types used by schema builders and factories

## Subpath export: `@alpha.consultings/eloquent-orm.js/Model`

### Named exports

* `SqlModel`
* `MongoModel`
* `ModelInstance`
* `ModelAttrs`

### Subpath rules

* `@alpha.consultings/eloquent-orm.js/Model` has no default export.
* It does not expose the root `Model` alias.
* Use root import for Laravel-style SQL models:

```ts theme={null}
import { Model } from "@alpha.consultings/eloquent-orm.js";
```

## Common usage

```ts theme={null}
import { Model, column, registerModels, type ModelInstance } from "@alpha.consultings/eloquent-orm.js";
import { SqlModel, MongoModel, type ModelInstance as MongoInstance } from "@alpha.consultings/eloquent-orm.js/Model";
```

## Runtime transaction helpers

* `transaction(...)`: native SQL or Mongo transaction runner
* `lockedTransaction(...)`: native MySQL/PostgreSQL lock + transaction runner
* `model.withTransaction(...)`: convenience wrapper bound to the model connection

## Notes

* CLI commands are **not** part of the runtime API surface.
* New public exports must be added via `src/index.ts` or `src/Model.ts`.
* Public changes must be reflected in docs and test surfaces.
