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

# Runtime Overview

> The runtime contract for model creation, querying, updates, deletes, restore flows, and cache-aware application design.

# Runtime Overview

Use this section when you are already past installation and want the actual runtime contract.

The runtime surface should be read as:

* `new User()` for a transient in-memory model instance
* `User.create(...)` for one-shot persistence
* `User.createMany(...)` for explicit bulk inserts
* `User.find(...)`, `User.findOneBy(...)`, and safe-finder chains for reads
* loaded-instance `update(...); save()` and `patch(...)` for readable mutation
* `User.updateMany(...)`, `User.patchMany(...)`, `User.deleteMany(...)`, and `User.restoreMany(...)` for explicit bulk writes
* `User.updateById(...)`, `User.deleteById(...)`, and `User.restoreById(...)` for explicit low-level by-id service paths

## Start with these pages

* [Runtime CRUD](./crud)
* [Runtime Querying](./querying)
* [Runtime Models](./models)
* [Runtime Controllers](./controllers)
* [Runtime Services](./services)
* [Runtime Transactions](./transactions)
* [Runtime Cache](./cache)

## Practical rule

If the code is application-facing and should stay readable:

1. query first
2. mutate the loaded instance
3. persist with `save()` or `patch()`

If the code is an intentionally thin service helper and already has the primary key:

1. use `User.updateById(...)`
2. use `User.deleteById(...)`
3. use `User.restoreById(...)`

If the code is an explicit bulk service flow and already has the target ids or rows:

1. use `User.createMany(...)`
2. use `User.updateMany(...)` or `User.patchMany(...)`
3. use `User.deleteMany(...)` or `User.restoreMany(...)`

## Quick example

```ts theme={null}
const created = await User.create({
  name: "Alice",
  email: "alice@example.com",
});

const found = await User.find(created.id as number);
if (found) {
  found.update({ name: "Alice Updated" });
  await found.save();
}
```

## Related pages

* [Runtime Controllers](./controllers)
* [Runtime Services](./services)
* [Runtime Transactions](./transactions)
* [Soft Deletes and Restore](../orm/soft-deletes)
* [Mixin Scenarios](../orm/mixin-scenarios)
