Skip to content

basalt / generator/src / GeneratorOptions

Interface: GeneratorOptions ​

Defined in: generator/src/templates.ts:17

Properties ​

auth? ​

> optional auth?: boolean

Defined in: generator/src/templates.ts:46

Require an authenticated user on every generated route (meta.auth, enforced by @basaltkit/auth's authPlugin; the adapters refuse to boot when no plugin enforces it). Default: true — secure by default. Pass false (CLI: --public, or --no-auth) only for a deliberately public resource.


crud? ​

> optional crud?: boolean

Defined in: generator/src/templates.ts:71

Shape of the generated service.

true — the CRUD service delegating to the sibling repository (what make:resource emits, and the default of the programmatic API). false — a minimal domain service: the class, its injection token and a constructor with no dependencies, importing nothing but @basaltkit/core, so the file compiles on its own.

Left undefined, basalt make:service <Name> decides per invocation: CRUD when the sibling <name>.repository.ts and <name>.schema.ts are already in the target directory (see expectedSiblings), minimal when they are not — a service importing files nobody generated does not compile (TS2307). Force either shape with --crud / --no-crud.


prisma? ​

> optional prisma?: boolean

Defined in: generator/src/templates.ts:19

Generate a Prisma-backed repository (and a schema.prisma model) instead of in-memory.


prismaClient? ​

> optional prismaClient?: PrismaClientRef

Defined in: generator/src/templates.ts:33

The Prisma client the repository is typed against. Defaults to PrismaClient from @prisma/client.

An application with more than one client — schema-per-tenant, database-per-tenant, a read replica — needs the other one, and against it the default either fails to compile or, worse, compiles and points at the wrong models.

ts
prismaClient: { import: '../../tenant-db.js', type: 'TenantDb' }

softDelete? ​

> optional softDelete?: boolean

Defined in: generator/src/templates.ts:39

Add a soft-delete column (deletedAt): delete marks the row instead of removing it, list/find skip soft-deleted rows, and a restore() method (+ POST /…/:id/restore route) brings it back.


tenant? ​

> optional tenant?: boolean

Defined in: generator/src/templates.ts:55

Treat the resource as tenant-owned: the repository scopes every read and write to the context tenant via requireTenantId() from @basaltkit/tenancy (fail-closed: no tenant → 400, never unscoped), and the Prisma model gets an indexed tenantId column. Default: false here; the make:* CLI commands turn it on when the project depends on @basaltkit/tenancy (opt out with --no-tenant).

Released under the MIT License.