Skip to main content

TypeORM Entity Generator

Generate TypeORM entity classes with proper decorators. Define your table name, columns, types, and constraints, and get production-ready TypeScript entity code with @Entity, @Column, and relation decorators.

✓ @Entity, @Column decorators ✓ @PrimaryGeneratedColumn types ✓ @CreateDateColumn / @UpdateDateColumn ✓ TypeScript types inferred

Entity Configuration

Custom Columns

Generated Entity

 

Frequently Asked Questions

What is TypeORM and what databases does it support?▼

TypeORM is a TypeScript ORM that supports Active Record and Data Mapper patterns. It works with PostgreSQL, MySQL, MariaDB, SQLite, Microsoft SQL Server, Oracle, MongoDB, and more. It integrates tightly with TypeScript decorators, making entity definitions readable and type-safe. It's commonly used with NestJS.

What is the difference between @PrimaryGeneratedColumn('increment') and @PrimaryGeneratedColumn('uuid')?▼

@PrimaryGeneratedColumn('increment') creates an auto-incrementing integer PK (SERIAL in PostgreSQL, AUTO_INCREMENT in MySQL). @PrimaryGeneratedColumn('uuid') generates a UUID v4 as the PK — better for distributed systems where global uniqueness matters. Use integers for simplicity and performance; UUIDs for distributed or external-facing IDs.

What does @CreateDateColumn and @UpdateDateColumn do?▼

@CreateDateColumn automatically sets the column to the current timestamp when the entity is first inserted. @UpdateDateColumn automatically updates to the current timestamp on every save/update. Both are stored as TIMESTAMP (or DATETIME in MySQL) and require no manual handling in your application code.

How does @Column with type 'json' work in TypeORM?▼

The json type maps to JSON in MySQL and JSONB in PostgreSQL by default. You can store arbitrary JavaScript objects. Use @Column({ type: 'json', nullable: true }) for optional JSON fields. For PostgreSQL-specific JSONB with full indexing support, use @Column({ type: 'jsonb' }) explicitly.

What is the difference between @Entity('table_name') and @Entity()?▼

@Entity() without arguments uses the class name (lowercased) as the table name. @Entity('orders') explicitly sets the table name to 'orders'. Best practice is to always set explicit table names to avoid surprises from class renaming. TypeORM also supports schema-qualified names: @Entity({ schema: 'public', name: 'orders' }).

Share this tool: X / Twitter LinkedIn
✓ 60,000+ developers use DevPlaybook ★★★★★ 4.8 / 5 on Gumroad ✓ MIT licensed · Instant download ✓ No login required

Related Products

on Gumroad

You Might Also Need

More Free Tools

Terraform Resource Generator Terraform Variable Builder Code Tools Terraform Variable Validator SQL Query Formatter Pro Neon DB Query Builder Turso Edge DB Explorer Terraform tfvars Generator SQL to TypeScript Types Terraform Variable Generator TypeScript Discriminated Union Builder Web Performance Checklist JavaScript Formatter & Minifier Number Formatter SQL Formatter & Beautifier TypeScript Playground TypeScript to JavaScript Converter SQL ERD Diagram Generator JSON Schema Form Builder TypeScript tsconfig.json Generator Prisma Schema Visualizer Drizzle Schema Generator PostgreSQL Connection String Builder JSON to TypeScript Interface Prettier Config Generator XML Formatter & Validator SQL Index Advisor PostgreSQL EXPLAIN Analyzer SQL Query Formatter Terraform State Inspector Database Index Analyzer GraphQL Query Formatter Database Schema Visualizer Lighthouse Score Simulator AWS CDK Infrastructure as Code Guide Pulumi Modern IaC Guide XML Prettifier Database Index Advisor Pulumi Stack Config Generator Web Vitals Budget Planner Zustand Store Builder GraphQL Client Configurator Axios Interceptor Builder Jest Mock Generator Database Schema Diff PlanetScale Branch Manager Core Web Vitals Guide API Response Formatter & Analyzer Color Format Converter CSS Formatter & Minifier CSV Editor ESLint Config Generator Git Commit Message Generator HTML Formatter & Minifier JSON Formatter Pro JSON Formatter & Validator Markdown Table Generator Resume Bullet Generator UUID Generator UUID v7 Generator YAML Validator & Formatter WebP Converter Web Vitals Scorer Biome Config Generator GCP Service Account Key Checker HAR Diff Analyzer MySQL Query Explainer Vitest Configuration Generator k6 Load Test Script Generator HTTP/2 Server Push Headers Builder Kafka Topic Config Generator Jest Coverage Config Generator Web Vitals Analyzer YAML Validator Pro YAML to JSON Converter Storybook Component Development Guide Core Web Vitals Calculator Image Compression Estimator Sitemap.xml Validator CSV JSON Transformer JSON Schema to Zod Converter Prisma Schema Builder Playwright Test Generator AI Agent Memory Planner LLM JSON Schema Builder RAG Chunking Calculator Solana Program ID Generator Multi-Chain Wallet Address Validator ZITADEL Color Format Converter — HEX, RGB, HSL, HSV GitHub Actions Matrix Builder WebAssembly Binary Inspector LLM Benchmark Calculator k6 Script Generator TanStack Query Config Builder SWR Config Generator Jotai Atom Explorer RAG Chunking Calculator OpenAI Function Calling Generator Core Web Vitals Budget Calculator Bundle Size Budget Calculator Image Optimization Calculator TTFB Analyzer Embedding Storage Calculator RAG Chunk Size Optimizer Database Query Cost Analyzer React Component Generator

Enjoying this tool? Get more like it.

Weekly developer tool guides, productivity playbooks & AI tricks. Free. No spam.

DevPlaybook Pro 7 days free

Unlock AI-Powered Dev Tools

  • ⚡ AI Code Review, Doc Generator & SQL Builder
  • ⚡ All premium templates & early access
  • ⚡ Member discounts on Gumroad products
Start Free Trial →

$9/mo after trial · Cancel anytime

Want the full toolkit?

Get DevPlaybook Pro

Every template, guide, boilerplate, and automation script in one bundle. 13 premium products — grab them all at once and save big.

$79
$241 separately Save $162 (67% off)
Get DevPlaybook Pro — $79 →

MIT licensed · Instant download · No subscription

See what's included → Browse all deals →