Installation
Five minutes from zero to a project that loads Cascade. No conceptual content on this page — pure mechanics. Three steps: install the packages, install your driver, turn on decorators. If you’re done before your coffee finishes brewing, that’s the right amount of time.
Prerequisites
Section titled “Prerequisites”- Node.js 20+ (current active LTS).
- TypeScript 5+ in the project.
- A database — either MongoDB or PostgreSQL — running locally or reachable by connection string. If you don’t have one yet, install MongoDB or PostgreSQL first. Cascade works the same against either.
Step 1 — Install Cascade and seal
Section titled “Step 1 — Install Cascade and seal”Cascade ships with @warlock.js/seal as a dependency, but you’ll import directly from seal in your schemas (v and Infer). Install both explicitly so they’re both in your package.json — stricter package managers (pnpm strict mode, Yarn PnP) need it.
import { Tabs, TabItem } from “@astrojs/starlight/components”;
npm install @warlock.js/cascade @warlock.js/sealpnpm add @warlock.js/cascade @warlock.js/sealyarn add @warlock.js/cascade @warlock.js/sealbun add @warlock.js/cascade @warlock.js/sealBoth packages are now in your package.json. You’ll import the ORM bits (Model, RegisterModel, relation helpers) from @warlock.js/cascade, and the schema bits (v, Infer) from @warlock.js/seal.
Step 2 — Install your database driver
Section titled “Step 2 — Install your database driver”Cascade speaks MongoDB and PostgreSQL through separate peer dependencies. Install the one you’re using:
For MongoDB:
npm install mongodbFor PostgreSQL:
npm install pgThat’s the entire driver story from the install side. Cascade picks it up via configuration on the next page — you don’t import it directly.
Step 3 — Turn on decorators
Section titled “Step 3 — Turn on decorators”Cascade uses @RegisterModel() to put each model into a global registry, and @BelongsTo / @HasMany / etc. to declare relations. If decorators don’t run, the registry stays empty, decorator-based relations never hoist, and your models break at runtime with confusing errors.
So: turn decorators on. Mandatory, not optional.
Add this to your tsconfig.json:
{ "compilerOptions": { "target": "ES2022", "experimentalDecorators": true, "emitDecoratorMetadata": true, "strict": true }}Three things this does:
experimentalDecoratorsmakes@RegisterModel()compile.emitDecoratorMetadatalets Cascade read decorator-attached metadata at runtime.strictcatches the kind of schema-vs-class drift you want to know about at compile time, not at 2am.
You’ve got:
- Cascade and seal installed
- One database driver installed (Mongo or Postgres)
- TypeScript ready for decorators
Nothing’s running yet — that’s the next page.
Continue to Configuration to connect Cascade to your database.