> ## 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.

# Quick start

title: Quick Start
description: Start with model + migration + seed in one pass.
-------------------------------------------------------------

# Quick Start

Version: `1.3.0`

## Quick setup

Install the package, Express.js, and the minimum TypeScript tooling first:

```bash theme={null}
npm install @alpha.consultings/eloquent-orm.js express
npm install -D typescript ts-node @types/express @types/node
```

`dotenv` and `@faker-js/faker` are already included by the package runtime. Install them separately only if your own app imports them directly:

```bash theme={null}
npm install dotenv @faker-js/faker
```

Set one active app connection and one active test connection in `.env`.
Do not place multiple connection names in `DB_CONNECTION`.

Quick `.env` key list:

* `DB_CONNECTION`
* `DB_TEST_CONNECTION`
* `DB_*` or `PG_*` or `SQLITE_*` or `MONGO_*`

Minimal SQLite `.env`:

```env theme={null}
DB_CONNECTION=sqlite
DB_TEST_CONNECTION=sqlite_test
SQLITE_PATH=./storage/app.sqlite
SQLITE_TEST_PATH=./storage/app.test.sqlite
```

```bash theme={null}
eloquent make:model Post --with-migration
eloquent make:service Post
eloquent make:controller Post
```

This creates:

* `src/app/models/Post.ts`
* `src/app/services/PostService.ts`
* `src/app/controllers/PostController.ts`
* a migration file for your configured target

## Runtime setup

This ORM is compatible with Express.js and is typically used in Express route handlers.
In this setup, `registerModels` runs safely at startup and models work without integration issues.

1. Ensure model registration is completed at app bootstrap.

```ts theme={null}
import { registerModels } from "@alpha.consultings/eloquent-orm.js";
import { User } from "./app/models/User";
import { Post } from "./app/models/Post";

registerModels([User, Post]);
```

2. Generate and apply migrations in order.

```bash theme={null}
eloquent make:migration --all
eloquent migrate:run --test --all-migrations
```

3. Seed test fixtures and run a demo scenario.

```bash theme={null}
eloquent db:seed --test --class BlogScenarioSeeder
eloquent demo:scenario --test --random
```

4. Create, query, update, and delete records.

```ts theme={null}
const created = await Post.create({ title: "Hello ORM JS" });
const found = await Post.find(created.id as number);

if (found) {
  found.update({ title: "Hello ORM JS Updated" });
  await found.save();
}

await Post.deleteById(created.id as number);
```

5. If the model uses soft deletes, restore instead of recreating.

```ts theme={null}
const deleted = await Post.find(1);
if (deleted) {
  await deleted.restore();
}
```

## Next steps

* [Runtime usage guides](./usage-guides)
* [Common scenarios](./common-scenarios)
* [Cookbook](./cookbook)
* [Controllers](./controllers)
* [Services](./services)
* [CLI commands](../cli/commands)
* [Migration runbook](../orm/migrations)
