Neogma
Example Applications

Legacy Decorators

Example app using experimental (legacy) decorators

Legacy Decorators Example

Source: examples/basic-app-legacy-decorators

This example uses TypeScript's experimental decorators. Use this approach when your project already has experimentalDecorators: true in its tsconfig (common with NestJS, Angular, etc.).

Differences from TC39 decorators

The only difference is the import path and tsconfig:

// tsconfig.json
{
  "compilerOptions": {
    "experimentalDecorators": true,
    "emitDecoratorMetadata": true
  }
}
// Import from 'neogma/legacy' instead of 'neogma'
import {
  Node,
  PrimaryKey,
  Property,
  Relationship,
  NodeEntity,
  Type,
} from 'neogma/legacy';

Everything else (model definition, CRUD, QueryBuilder, etc.) is identical to the TC39 decorators example.

Running

cd examples/basic-app-legacy-decorators
pnpm install
pnpm start

On this page