From Beginner to Production-Ready Applications
A comprehensive, hands-on course that takes you from zero to hero with TypeORM, TypeScript, and Node.js. Build real-world applications with PostgreSQL.
| Duration | ~40-50 hours |
|---|---|
| Level | Beginner to Advanced |
| Prerequisites | Basic JavaScript knowledge |
| Database | PostgreSQL |
| Framework | Express.js (with NestJS bonus) |
By the end of this course, you will be able to:
- β Understand ORMs and why TypeORM is a powerful choice
- β Set up TypeORM with TypeScript and Node.js from scratch
- β Design and implement database entities with decorators
- β Master all relationship types (One-to-One, One-to-Many, Many-to-Many)
- β Build production-ready REST APIs with Express
- β Handle migrations like a pro
- β Implement soft deletes, transactions, and caching
- β Write testable database code
- β Deploy applications with Docker
- β Build a complete capstone project
- What is an ORM?
- Why use TypeORM?
- TypeORM vs Raw SQL
- TypeORM Architecture Overview
- Active Record vs Data Mapper Pattern
- Installing Node.js and TypeScript
- Setting up PostgreSQL
- Creating a TypeORM project from scratch
- Understanding
DataSourceconfiguration - Environment variables and configuration management
- TypeORM CLI setup
- What are Entities?
- Column types and options
- Primary columns and generated values
- Special columns (CreateDateColumn, UpdateDateColumn, etc.)
- Column transformers
- Entity inheritance
- Understanding Repositories
- Repository methods (find, save, update, delete)
- Custom repositories
- Repository pattern best practices
- DataSource API vs Repository API
- Setting up Express with TypeORM
- Building RESTful endpoints
- Request validation
- Error handling
- Project: Building a complete CRUD API
- Why migrations matter
- Generating migrations
- Running and reverting migrations
- Migration best practices
- Migrations in production
- One-to-One relationships
- One-to-Many / Many-to-One relationships
- Many-to-Many relationships
- Self-referencing relationships
- Cascade operations
- Eager vs Lazy loading
- Relationship best practices
- Introduction to QueryBuilder
- SELECT queries
- INSERT, UPDATE, DELETE with QueryBuilder
- Joins and subqueries
- Raw queries
- When to use QueryBuilder vs Repository
- What is soft delete?
- Implementing soft deletes
- Querying soft-deleted records
- Restoring deleted records
- Best practices
- Why seed data?
- Creating seed scripts
- Using factories for test data
- Seeding in different environments
- Understanding transactions
- Transaction isolation levels
- Implementing transactions in TypeORM
- Nested transactions
- Error handling in transactions
- Database indexing
- Query optimization
- Relation loading strategies
- Caching with TypeORM
- Connection pooling
- Logging and debugging
- Entity subscribers and event listeners
- Embeddable entities
- Custom repositories (advanced)
- DTO validation with class-validator
- Multi-database connections
- Unit testing repositories
- Integration testing with test database
- Mocking TypeORM
- E2E testing strategies
- Test fixtures and factories
- Project requirements
- Database design
- Implementation step-by-step
- Authentication and authorization
- Complete API documentation
- Dockerizing your application
- Docker Compose for development
- Environment configuration
- Production deployment checklist
- CI/CD considerations
- TypeORM vs Sequelize vs Prisma
- TypeORM v0.3+ syntax changes
- Multi-tenant architecture
- Migrations in CI/CD pipelines
- Repository vs DataSource APIs
typeorm-course/
βββ README.md # This file
βββ CHEATSHEET.md # Quick reference guide
βββ section-01-introduction/ # Introduction to ORMs
βββ section-02-setup/ # Project setup
βββ section-03-entities/ # Entities and decorators
βββ section-04-repositories/ # Repository pattern
βββ section-05-crud-express/ # CRUD with Express
βββ section-06-migrations/ # Database migrations
βββ section-07-relationships/ # All relationship types
βββ section-08-querybuilder/ # QueryBuilder deep dive
βββ section-09-soft-deletes/ # Soft delete pattern
βββ section-10-seeding/ # Database seeding
βββ section-11-transactions/ # Transaction management
βββ section-12-performance/ # Performance optimization
βββ section-13-advanced/ # Advanced topics
βββ section-14-testing/ # Testing strategies
βββ section-15-capstone/ # Final project
βββ section-16-deployment/ # Docker deployment
βββ bonus-section/ # Comparisons and extras
βββ examples/ # Complete example applications
βββ express-typeorm-blog-app/ # Express + TypeORM Blog (migrations, relationships, transactions)
βββ nestjs-typeorm-app/ # NestJS + TypeORM Blog
A comprehensive blog application demonstrating all TypeORM fundamentals:
- Entities: Author, Post, Comment with relationships
- Migrations: Complete migration setup with up/down methods
- Transactions: Atomic operations for complex business logic
- Soft Deletes: Post entity with soft delete support
- Query Builder: Advanced queries in services
cd examples/express-typeorm-blog-app
npm install
cp .env.example .env
npm run migration:run
npm run devThe same blog application built with NestJS framework:
- Module-based architecture: Users, Posts, Comments modules
- Dependency Injection: Repository injection with @InjectRepository
- DTO Validation: Request validation with class-validator
- Best Practices: Production-ready NestJS patterns
cd examples/nestjs-typeorm-app
npm install
cp .env.example .env
npm run migration:run
npm run start:dev| Technology | Version | Purpose |
|---|---|---|
| Node.js | 18+ | Runtime |
| TypeScript | 5.x | Language |
| TypeORM | 0.3.x | ORM |
| PostgreSQL | 15+ | Database |
| Express | 4.x | Web Framework |
| Jest | 29.x | Testing |
| Docker | Latest | Containerization |
-
Node.js (v18 or higher)
node --version
-
PostgreSQL (v15 or higher)
psql --version
-
npm or yarn
npm --version
# Clone or navigate to the course folder
cd typeorm-course
# Each section has its own project
cd section-02-setup/demo
# Install dependencies
npm install
# Set up environment variables
cp .env.example .env
# Run the project
npm run dev- Follow in order: Each section builds on the previous one
- Type the code: Don't just copy-paste; type it out for better learning
- Complete assignments: Each section has homework tasks
- Build the capstone: Apply everything you've learned
- Reference the cheatsheet: Use it as a quick lookup
- π TypeORM Cheatsheet
- π Common Mistakes Guide
- β Production Checklist
- ποΈ Architecture Diagrams
- π Additional Resources
- TypeORM Documentation
- TypeORM GitHub
- TypeScript Documentation
- PostgreSQL Documentation
- Express Documentation
This course is designed to be practical, hands-on, and production-focused. Every concept is explained with real-world examples and best practices.
This course material is provided for educational purposes.
Happy Learning! π