Interactive CLI for generating TypeORM entities for NestJS applications with a nice UX.
- 🖥️ Create database tables visually through an interactive CLI
- 🔄 Generate TypeORM entity classes for NestJS
- 📊 Support for all common data types
- 🔗 Define relationships between entities
- 📝 Generate clean, well-formatted TypeScript code
npm install -g typeorm-visualnpm install typeorm-visual# Start interactive entity creator
typeorm-visual create
# Generate entities from a JSON schema file
typeorm-visual generate --file schema.jsonFor detailed usage instructions, see the Usage Guide.
Looking for examples of schema files?
- Blog application schema - A complete blog with users, posts and comments
- See the schema format documentation
The CLI will guide you through the process of creating entities:
- Enter entity name (e.g., User)
- Specify table name (defaults to snake_case of entity name)
- Add columns with their data types and constraints
- Define relationships between entities
The generated files will be placed in the output/entities directory within your project.
import { Entity, Column, PrimaryGeneratedColumn } from 'typeorm';
import { OneToMany } from 'typeorm';
import { Post } from './post.entity';
@Entity('users')
export class User {
@PrimaryGeneratedColumn()
id: string;
@Column({ type: 'varchar', length: 100, unique: true })
username: string;
@Column({ type: 'varchar', length: 255 })
email: string;
@OneToMany(() => Post, (post) => post.author)
posts: Post[];
}# Clone the repository
git clone https://github.com/opestro/typeorm-visual.git
cd typeorm-visual
# Install dependencies
npm install
# Run in development mode
npm run dev
# Build the package
npm run buildISC
Mehdi Harzallah
- GitHub: opestro
- LinkedIn: mehdi-harzallah
- Email: [email protected]
- WhatsApp: +213 0778191078
