CommunityCodierung & Entwicklunggithub.com

mindrally/typeorm

Richtlinien für die Entwicklung mit TypeORM, einem voll ausgestatteten ORM für TypeScript und JavaScript, das mehrere Datenbanken unterstützt

Was ist typeorm?

Diese Fähigkeit enthält Richtlinien für die Entwicklung mit TypeORM, einem beliebten ORM (Object-Relational Mapping) für TypeScript und JavaScript. Es ist besonders nützlich für Entwickler, die mit TypeORM in Projekten arbeiten, die Datenbanken wie PostgreSQL, MySQL, SQLite und andere unterstützen. Die Fähigkeit beschreibt Best Practices für die Definition von Entitäten, die Verwendung von Relationen, das Erstellen von Migrationen und die Verwaltung von Datenbankverbindungen. Sie integriert sich nahtlos in KI-gestützte Codierungsassistenten wie Claude Code, Cursor und Codex, um eine konsistente und effiziente Entwicklungsumgebung zu gewährleisten. Die Richtlinien helfen, häufige Fehler zu vermeiden und die Leistung zu optimieren, während sie gleichzeitig die Lesbarkeit und Wartbarkeit des Codes verbessern.

Funktioniert mit~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/mindrally/skills/tree/main/skills/typeorm

Installed? Explore more Codierung & Entwicklung skills: steipete/bluebubbles, steipete/eightctl, steipete/blucli · View all 6 →

In Ihrer bevorzugten KI fragen

Öffnet einen neuen Chat, in dem dieser Agent-Skill bereits geladen ist.

Dokumentation

Was macht typeorm?

Richtlinien für die Entwicklung mit TypeORM, einem voll ausgestatteten ORM für TypeScript und JavaScript, das mehrere Datenbanken unterstützt

Übersicht

TypeORM ist ein ORM, das mit TypeScript und JavaScript funktioniert und eine breite Palette von Datenbanken wie PostgreSQL, MySQL, MariaDB, SQLite und MS SQL Server unterstützt. Es bietet deklarative Entitätendefinitionen, Migrationen, Relationen und eine leistungsstarke Query Builder API.

Grundlegende Richtlinien

Entitätendefinitionen

Entitäten werden mit Klassen und Dekorateuren definiert. Verwende immer den Dekorator @Entity() für die Klasse und @PrimaryGeneratedColumn() für Primärschlüssel.

import { Entity, PrimaryGeneratedColumn, Column } from "typeorm";

@Entity()
export class User {
    @PrimaryGeneratedColumn()
    id: number;

    @Column()
    name: string;

    @Column({ unique: true })
    email: string;
}

Relationen

Verwende die Dekorateure @OneToOne, @OneToMany, @ManyToOne und @ManyToMany für Relationen. Gib immer die Zielentität und die inverse Seite an.

import { Entity, PrimaryGeneratedColumn, Column, ManyToOne, JoinColumn } from "typeorm";

@Entity()
export class Photo {
    @PrimaryGeneratedColumn()
    id: number;

    @Column()
    url: string;

    @ManyToOne(() => User, (user) => user.photos)
    @JoinColumn()
    user: User;
}

Migrationen

Migrationen werden mit der TypeORM CLI erstellt. Verwende typeorm migration:create -n MigrationName für neue Migrationen und typeorm migration:run zum Ausführen.

npx typeorm migration:create -n CreateUserTable

Verbindungskonfiguration

Verwende eine Konfigurationsdatei (z. B. ormconfig.json oder data-source.ts), um die Datenbankverbindung zu definieren. Verwende Umgebungsvariablen für sensible Daten.

import { DataSource } from "typeorm";

export const AppDataSource = new DataSource({
    type: "postgres",
    host: process.env.DB_HOST,
    port: parseInt(process.env.DB_PORT || "5432"),
    username: process.env.DB_USERNAME,
    password: process.env.DB_PASSWORD,
    database: process.env.DB_DATABASE,
    entities: [__dirname + "/entities/**/*{.ts,.js}"],
    migrations: [__dirname + "/migrations/**/*{.ts,.js}"],
    synchronize: false,
});

Weitere Informationen

Weitere Details findest du in der offiziellen TypeORM Dokumentation.

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

mindrally/accessibility-a11y

Implement web accessibility (a11y) best practices following WCAG guidelines to create inclusive, accessible user interfaces.

mindrally/chrome-extension-development

Expert guidelines for Chrome extension development with Manifest V3, covering security, performance, and best practices. Use when building browser extensions, creating popup UIs, implementing content scripts, working with Chrome APIs, managing extension permissions, or publishing to Chrome Web Store.

mindrally/computer-vision-opencv

Expert guidance for computer vision development using OpenCV, PyTorch, and modern deep learning techniques for image and video processing.

mindrally/data-analysis-jupyter

Expert guidance for data analysis, visualization, and Jupyter Notebook development with pandas, matplotlib, seaborn, and numpy.

mindrally/deep-learning-pytorch

Expert guidance for deep learning, transformers, diffusion models, and LLM development with PyTorch, Transformers, Diffusers, and Gradio.

mindrally/expo-react-native-typescript

Expert in Expo React Native TypeScript mobile development with best practices

mindrally/fastapi-python

Expert in FastAPI Python development with best practices for APIs and async operations

mindrally/framer-motion

Expert guidelines for building performant animations with Framer Motion/Motion library in React applications

mindrally/htmx

HTMX development guidelines for building dynamic web applications with minimal JavaScript using HTML attributes.

mindrally/jwt-security

Guidelines for implementing JWT authentication with security best practices for token creation, validation, and storage

mindrally/machine-learning

Machine learning development with JAX, functional programming patterns, and high-performance computing.

mindrally/mysql-best-practices

MySQL development best practices for schema design, query optimization, and database administration

mindrally/nextjs-react-typescript

Expert in TypeScript, Node.js, Next.js App Router, React, Shadcn UI, Radix UI and Tailwind

mindrally/nextjs-typescript-tailwindcss-supabase

Full-stack Next.js 14 development with TypeScript, TailwindCSS, and Supabase for building production-ready web applications.

mindrally/odoo-development

Expert guidance for Odoo ERP development including Python ORM, XML views, and module architecture

mindrally/puppeteer-automation

Expert guidance for browser automation using Puppeteer with best practices for web scraping, testing, screenshot capture, and JavaScript execution in headless Chrome.

mindrally/redis-best-practices

Redis development best practices for caching, data structures, and high-performance key-value operations

mindrally/scrapy-web-scraping

Expert guidance for building web scrapers and crawlers using the Scrapy Python framework with best practices for spider development, data extraction, and pipeline management.

mindrally/scss-best-practices

SCSS/Sassy CSS best practices and coding guidelines for maintainable, scalable stylesheets

mindrally/web-scraping

Expert in web scraping and data extraction with Python tools

Verwandte Skills