Skip to content

Modernize NestJS from 7.4.2 to 10.4.19 and TypeORM from 0.2.25 to 0.3.20#8

Open
devin-ai-integration[bot] wants to merge 2 commits intomasterfrom
devin/1753785964-nestjs-dependency-modernization
Open

Modernize NestJS from 7.4.2 to 10.4.19 and TypeORM from 0.2.25 to 0.3.20#8
devin-ai-integration[bot] wants to merge 2 commits intomasterfrom
devin/1753785964-nestjs-dependency-modernization

Conversation

@devin-ai-integration
Copy link
Copy Markdown

Modernize NestJS from 7.4.2 to 10.4.19 and TypeORM from 0.2.25 to 0.3.20

Summary

This PR modernizes the banking application's core dependencies from legacy versions to latest stable releases, addressing security vulnerabilities and enabling access to modern framework features. The upgrade spans multiple breaking changes requiring systematic migration of repository patterns, security middleware, and module configurations.

Key Changes:

  • NestJS Framework: 7.4.2 → 10.4.19 (latest stable v10.x)
  • TypeORM: 0.2.25 → 0.3.20 with complete repository pattern migration
  • Security Dependencies: Updated bcrypt, helmet, @nestjs/jwt, passport-jwt to latest versions
  • Breaking Change Migrations: Replaced deprecated @entityrepository with @InjectRepository patterns across all services
  • Infrastructure Updates: New TypeORM CLI commands, updated HTTP client, modernized build toolchain

Review & Testing Checklist for Human

⚠️ CRITICAL: This PR contains significant architectural changes that require thorough testing before deployment.

  • Database Connection & Migration Testing - Verify database connectivity works and existing migration scripts execute properly with TypeORM 0.3.x CLI
  • Authentication Flow End-to-End - Test login, JWT token generation/validation, and protected route access to ensure security middleware updates didn't break auth
  • Core Banking Operations - Verify transaction creation, bill management, currency exchange, and account balance calculations work correctly
  • Migration Script Execution - Run yarn migration:run and yarn migration:generate to ensure TypeORM CLI changes work properly
  • Performance Baseline - Compare memory usage and response times against previous version to detect any performance regressions

Recommended Test Plan:

  1. Start application with database connection
  2. Create test user account and login
  3. Create bills, perform transactions between accounts
  4. Generate and execute a test migration
  5. Verify all API endpoints return expected responses

Diagram

%%{ init : { "theme" : "default" }}%%
graph TB
    subgraph "Core Dependencies"
        PJ["package.json<br/>Major version bumps"]:::major-edit
        YL["yarn.lock<br/>Dependency resolution"]:::minor-edit
        TS["tsconfig.json<br/>Compiler options"]:::minor-edit
    end
    
    subgraph "TypeORM Migration"
        ORM["src/utils/ormconfig.ts<br/>DataSource pattern"]:::major-edit
        APP["src/modules/app/index.ts<br/>TypeORM config"]:::major-edit
    end
    
    subgraph "Service Layer"
        US["src/modules/user/services/<br/>Repository injection"]:::major-edit
        TS_SVC["src/modules/transaction/services/<br/>Repository injection"]:::major-edit
        BS["src/modules/bill/services/<br/>Repository injection"]:::major-edit
        MS["src/modules/message/services/<br/>Repository injection"]:::major-edit
    end
    
    subgraph "Security & Auth"
        MAIN["src/main.ts<br/>Helmet & rate limiting"]:::major-edit
        JWT["src/modules/auth/strategies/<br/>JWT strategy"]:::context
    end
    
    PJ --> ORM
    ORM --> US
    ORM --> TS_SVC
    ORM --> BS
    ORM --> MS
    MAIN --> JWT
    
    subgraph Legend
        L1["Major Edit"]:::major-edit
        L2["Minor Edit"]:::minor-edit
        L3["Context/No Edit"]:::context
    end
    
    classDef major-edit fill:#90EE90
    classDef minor-edit fill:#87CEEB
    classDef context fill:#FFFFFF
Loading

Notes

Migration Strategy Used:

  • Systematic replacement of @EntityRepository@InjectRepository(Entity) pattern
  • Updated all service constructors to use Repository<Entity> instead of custom repository classes
  • Maintained existing query builder patterns and business logic
  • Preserved circular dependency handling with forwardRef()

Potential Breaking Changes:

  • TypeORM CLI commands changed (migration scripts updated in package.json)
  • Helmet security headers may have different defaults
  • HTTP client behavior might differ slightly with @nestjs/axios

Testing Limitations:

  • Database connection unavailable in development environment
  • Runtime banking operations not tested due to DB connectivity issues
  • Migration scripts not executed (require DB connection)

Session Info:

devin-ai-integration Bot and others added 2 commits July 29, 2025 11:11
…to 0.3.20

- Upgrade all @nestjs/* packages to 10.4.19 (latest stable v10.x)
- Update TypeORM to 0.3.20 with new repository patterns
- Replace deprecated @entityrepository with @InjectRepository pattern
- Update security dependencies: bcrypt, helmet, @nestjs/jwt, passport-jwt
- Migrate typeorm-transactional-cls-hooked to typeorm-transactional
- Update HttpModule imports to @nestjs/axios
- Fix Transform decorator for class-transformer updates
- Update TypeORM configuration for DataSource pattern
- Centralize ORM config in src/utils/ormconfig.ts
- Update migration CLI commands for TypeORM 0.3.x
- Add TypeScript compiler options for compatibility
- Update all service constructors to use Repository<Entity> pattern

Breaking changes addressed:
- EntityRepository decorator removal
- TypeORM CLI command changes
- Security middleware API updates
- Module configuration updates for NestJS 10.x

Co-Authored-By: Arthur Poon <arthur.poon@windsurf.com>
Co-Authored-By: Arthur Poon <arthur.poon@windsurf.com>
@devin-ai-integration
Copy link
Copy Markdown
Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants