Skip to content

opestro/TypeORM-Visual

Repository files navigation

🎨 TypeORM Visual

Interactive CLI for generating TypeORM entities for NestJS applications with a nice UX.

TypeORM Visual CLI

✨ Features

  • 🖥️ 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

🚀 Installation

Global installation

npm install -g typeorm-visual

Local installation

npm install typeorm-visual

🏁 Quick Start

# Start interactive entity creator
typeorm-visual create

# Generate entities from a JSON schema file
typeorm-visual generate --file schema.json

📚 Documentation

For detailed usage instructions, see the Usage Guide.

JSON Schema Examples

Looking for examples of schema files?

🧩 Example

The CLI will guide you through the process of creating entities:

  1. Enter entity name (e.g., User)
  2. Specify table name (defaults to snake_case of entity name)
  3. Add columns with their data types and constraints
  4. Define relationships between entities

The generated files will be placed in the output/entities directory within your project.

📋 Sample Generated Entity

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[];
}

💻 Development

# 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 build

📜 License

ISC

👨‍💻 Author

Mehdi Harzallah

About

Interactive CLI for generating TypeORM entities for NestJS applications with a nice UX.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published