Overview
This guide helps you migrate between major versions of Express Zod API. The framework provides automated migration tools to handle most breaking changes.Express Zod API follows semantic versioning. Major version updates may include breaking changes, while minor and patch versions maintain backward compatibility.
Automated Migration Tool
The framework includes an ESLint plugin that automatically fixes most breaking changes:Basic Configuration
Create or update youreslint.config.mjs:
Run Migration
Version 27 (Current)
From v26 to v27
Key Changes:- TypeScript Dependency: Now optional, only required for
Integration - Integration Constructor: Requires explicit
typescriptproperty or use asynccreate() - Zod Plugin: Uses inheritable metadata feature from Zod 4.3+
Option 1: Import and Assign TypeScript
Option 2: Use Async Factory
Version 26
From v25 to v26
Key Changes:- Method-based routing:
DependsOnMethodremoved in favor of direct method keys - Renamed properties:
options→ctx,addOptions()→addContext() - Integration config: Now requires
configproperty - http-errors: Updated to v2.0.1+
- Zod: Updated to v4.1.13+ (CJS and ESM fix)
Method-Based Routing
Context Rename
Integration Config
Version 25
From v24 to v25
Key Changes:- Node.js: Minimum versions 20.19.0, 22.12.0, or 24.0.0
- ESM-only: Framework distribution is now ESM-only
- Zod 4: Must import from
zod(notzod/v4) - Metadata: Removed
exampleproperty support in.meta() - Middleware input: Now
unknownwhen schema not defined
Zod Import
Examples Syntax
Date Schemas
Version 24
From v23 to v24
Key Changes:- Zod 4: Switched to Zod v4 (import from
zod/v4) - Example syntax:
.example()now takes output type (after transformation) - Date schemas: Accept metadata as argument
- File schema:
ez.file()removed, usez.string(),z.base64(), orez.buffer() - Documentation: Mostly delegated to Zod’s
toJSONSchema() - ResultHandler: Discriminated argument (either
outputorerror, not both)
Import Changes
Example Placement
Date Schema Changes
File Schema Replacement
Version 23
From v22 to v23
Key Changes:- Express: Minimum version 5.1.0 (first stable v5)
- Wrong method behavior: Default changed to
405(Method Not Allowed) - Security interfaces:
CustomHeaderSecurityrenamed toHeaderSecurity - Public API: Many internal methods marked internal
- Testing:
errorHandlermoved to config fromtestMiddleware()
Express Upgrade
Config Default
The default forwrongMethodBehavior changed:
Testing Changes
Version 22
From v21 to v22
Key Changes:- Node.js: Minimum versions 20.9.0 and 22.0.0 (dropped Node 18)
- Headers as input: All headers addressed (not just
x-prefixed) - Tagging: Tags moved to
Documentationconstructor, useTagOverridesinterface - Generated client: Class renamed
ExpressZodAPIClient→Client - Integration:
splitResponseproperty removed (always splits)
Headers Configuration
Tagging Changes
Factory Changes
Client Usage
Common Patterns
Updating Dependencies
Always update peer dependencies when upgrading:Checking Breaking Changes
Read the changelog before upgrading:Testing After Migration
Always run your test suite after migration:- TypeScript compilation errors
- Failed tests
- Runtime errors
- Documentation generation
- Integration generation
Gradual Migration
For large codebases:- Create a new branch for migration
- Update dependencies
- Run automated migration
- Fix remaining TypeScript errors
- Run tests and fix failures
- Test generated documentation and client
- Deploy to staging environment
- Monitor for issues
- Merge to production
Version Support
| Version | Node.js | Express | Zod | Status |
|---|---|---|---|---|
| v27 | ^20.19, ^22.12, ^24 | ^5.1 | ^4.3.4 | Current |
| v26 | ^20.19, ^22.12, ^24 | ^5.1 | ^4.1.13 | Maintenance |
| v25 | ^20.19, ^22.12, ^24 | ^5.1 | ^4 | Maintenance |
| v24 | ^20.9, ^22 | ^5.1 | ^3.25.35 | Maintenance |
| v23 | ^20.9, ^22 | ^5.1 | ^3.23 | Maintenance |
| v22 | ^20.9, ^22 | ^4.21.1, ^5.0.1 | ^3.23 | Unsupported |
Troubleshooting
TypeScript errors after migration
TypeScript errors after migration
Ensure your
tsconfig.json has strict: true and skipLibCheck: true. Update @types/* packages to latest versions.Module resolution issues
Module resolution issues
For Zod 4, ensure
moduleResolution in tsconfig.json is node16, nodenext, or bundler.ESM/CJS compatibility
ESM/CJS compatibility
Express Zod API v25+ is ESM-only. Set
"type": "module" in package.json or use .mts extension.Zod plugin not working
Zod plugin not working
If using
require("zod") in CJS, you may get different instances. Use ESM or update to v26+ for proper CJS support.Generated client errors
Generated client errors
Regenerate both documentation and client after migration. The generated API may have changed.
Getting Help
- GitHub Issues: Report bugs or ask questions
- Changelog: Full version history
- Migration Package: Automated migration tool
Next Steps
- Review the Changelog for detailed changes
- Check Authentication Guide for updated patterns
- See API Reference for current API documentation