scan, list, describe, hover and er read TypeORM entities as well as Django, SQLAlchemy, Prisma, Drizzle, Rails and EF Core models, and so do the MCP tools list_apps, list_models, describe_model, find_relations and er_diagram. TypeORM has no schema file, so the entity classes themselves are read: their decorators, the base classes and mixins they extend, and the names TypeORM gives tables and columns. They are read as text, with no Node, no TypeScript compiler and no database.
uvx orm-lens scan -f table # every entity and join table
uvx orm-lens er -f dbml # ER diagram: mermaid, dbml, d2, plantuml or dot
uvx orm-lens describe Post # one entity: columns, keys and what each does on delete
The other commands don’t read TypeORM yet, and neither does the VS Code extension. The Django analyses never see a TypeORM entity, and a Python relation never points at one.
The .ts files of every package whose package.json depends on typeorm (or on a fork named .../typeorm, such as @n8n/typeorm). node_modules, dist, build, out, coverage, vendor, tmp, test, mock and fixture directories (test, tests, __tests__, __mocks__, e2e, fixtures), hidden directories, *.spec.ts, *.test.ts, *.d.ts and files over 2 MB are skipped; linked directories are not entered, and a linked file that leads outside the workspace is skipped. An entity in one of those places is not listed. A directory whose package.json lists dependencies of its own is another package: it is read only when it depends on TypeORM too. One that lists none (a workspace package that uses the root’s) is read with the root. Relative imports are followed as TypeScript resolves them (./base.js is base.ts, ./columns is columns.ts before columns/index.ts), through export * from and export { ... } from. Aliases from tsconfig.json paths (@app/columns) are not read: a class or decorator imported through one is matched by its name among the files read, which can pick the wrong one when two share that name. TypeORM’s own decorators (@Entity, @Column, …) count only when the file imports them from TypeORM, so a MikroORM @Entity() is not taken for one; a project’s own decorator that calls them counts too (see below).
In a workspace with no Django or SQLAlchemy project, the MCP server looks for such a package.json at most four directories down. If yours is deeper, point workspace_root at a directory closer to it. The CLI has no such limit.
Tables are the classes with @Entity() or @ViewEntity(), or with a project’s own decorator that calls Entity() (Medusa’s @FeatureFlagEntity(flag, name)), listed under their class name (with their path in front when two share one, and a number after that when even the paths match). The table is the name @Entity gives (@Entity("orders", { name: ... }) keeps orders, as TypeORM does), after its schema, or the class name in snake_case (OrderLine → order_line), as TypeORM’s default naming strategy has it. A project’s own decorator counts only where it is imported from the file that defines it.
Columns come from @Column, @PrimaryColumn, @PrimaryGeneratedColumn, @CreateDateColumn, @UpdateDateColumn, @DeleteDateColumn and @VersionColumn, and from a project’s own decorators that call one of them (export function JsonColumn(options) { return Column({ ...options, type: 'json' }) }). A project’s own decorator named Primary... (Vendure’s @PrimaryGeneratedId()) is taken for the primary key. The column is the property name unless name renames it. The type is the one the decorator names, with length, precision / scale and [] for arrays; a type held in a constant shows its choices (simple-json | json); without one it comes from the property’s TypeScript type (string → varchar, number → integer, boolean, Date → timestamp). A property with an initializer and no type (@Column("varchar") status = "open") is read too; the initializer is not a database default. A column is NOT NULL unless it has nullable: true, as in TypeORM. args also shows UNIQUE (from unique: true, @Unique() or a unique @Index() on the column alone, without where) and DEFAULT ..., the SQL of default: () => "now()" included.
Base classes and mixins. An entity has the columns of every class it extends, base first (a base class in a file that imports nothing from TypeORM is followed too), including mixins built by a function that returns a class (export const WithTimestamps = mixinCreatedAt(mixinUpdatedAt(BaseEntity))). A column inherited this way shows where it was declared. Single-table inheritance (@TableInheritance with @ChildEntity classes) adds the children’s columns to the parent’s table, where they are nullable, plus the discriminator column (type unless named); a key that points at a child points at that table.
Foreign keys come from @ManyToOne and from the owning side of @OneToOne (the one with @JoinColumn). The column is the one @JoinColumn names, or the property name followed by the target’s key (author → authorId). When the class declares that column too (@Column() authorId), the key goes on it; either way it has the type of the column it points at, as TypeORM gives it. referencedColumnName and composite keys are followed (a referencedColumnName that names a relation, "user", points at the join column TypeORM makes for it, userId), and so is a target in another module’s namespace (() => billing.Account). A @ManyToOne declared in a base class is a key of every entity that extends it, as in the database. The key is shown as a ForeignKey, or as a OneToOneField for @OneToOne or a key on the whole primary key or a unique column (one column of a composite primary key is not unique).
Delete policy is onDelete: CASCADE, SET NULL, RESTRICT and SET DEFAULT, and NO ACTION without it, as TypeORM creates the key. With createForeignKeyConstraints: false TypeORM makes the column but no constraint, so the key has no delete policy. A database built by hand-written migrations may say otherwise.
Join tables. A @ManyToMany with @JoinTable() adds its join table as a model: the name @JoinTable gives or TypeORM’s (post_tags_tag), in its schema or else the owner’s, and one column per key on each side (postId, tagId, or the names joinColumn(s) / inverseJoinColumn(s) give). As in TypeORM 0.3, the owner’s key deletes with the relation’s onDelete, or on cascade; the other key with the onDelete of the inverse relation the decorator names ((tag) => tag.posts), NO ACTION if that relation has none, or on cascade when there is no inverse relation. The inverse sides (@OneToMany, a @ManyToMany without @JoinTable, a @OneToOne without @JoinColumn) add no column and are listed under relationships.
SnakeNamingStrategy and the like) changes table and column names at run time; orm-lens shows the default ones.Column() (Vendure’s @Money() and @EntityId()) are not seen. A @ManyToOne without such a column still adds its key.@FeatureFlagDecorators(flag, [ManyToOne(...), JoinColumn(...)])) are not read.EntitySchema definitions, embedded entities (@Column(() => Name)) and tree entities’ closure tables are not read yet.All the entities of a workspace are one app, typeorm (typeorm_2 if another app already has that name), since they usually share one database and refer to each other across packages; packages with databases of their own are listed together all the same. orm-lens scan --format json marks them with "orm": "typeorm" and adds tableName. Django models serialize exactly as before.
The entities of n8n, Twenty, ToolJet, Vendure and Medusa 1.20 were read and compared with a separate count over the same source: every @Entity class, every key of a @ManyToOne and of an owning @OneToOne (once for each entity that inherits it), its target (a child of single-table inheritance counts as its parent’s table) and onDelete, and every @JoinTable. All 544 tables, 79 join tables and 785 foreign keys were found, no column was left without a type, and the DBML diagram has one reference per key. A project that defines its entities with EntitySchema (Activepieces) shows none. On the 29 Django and SQLAlchemy projects used for parser changes the output is the same as before.