kysely vs. typeorm
Side-by-side comparison · 9 metrics · 14 criteria
- Weekly Downloads
- 31.4M
- Stars
- 14.4K
- Gzip Size
- 39.5 kB
- License
- MIT
- Last Updated
- 9mo ago
- Open Issues
- 224
- Forks
- 464
- Unpacked Size
- 1.8 MB
- Dependencies
- 0
- Weekly Downloads
- 7.3M
- Stars
- 36.7K
- Gzip Size
- 147.6 kB
- License
- MIT
- Last Updated
- 8mo ago
- Open Issues
- 770
- Forks
- 6.7K
- Unpacked Size
- 21.8 MB
- Dependencies
- 10
kysely vs typeorm downloads · last 12 months
Criteria · kysely vs typeorm
- Learning Curve
- kysely ✓Focused query-builder abstraction for developers comfortable with SQLtypeormRequires working within an ORM persistence model and its abstractions
- NoSQL Targeting
- kyselyPresented as a SQL query buildertypeorm ✓Explicitly includes MongoDB in its supported database list
- Core Abstraction
- kyselyTyped SQL query builder centered on composing database queriestypeormData-mapper ORM with active-record also represented in its topics
- Database Breadth
- kyselyTopics identify SQL databases including PostgreSQL, MySQL, SQL Server, and SQLitetypeorm ✓Explicitly lists SQL databases plus Oracle, SAP HANA, and MongoDB
- SQL Transparency
- kysely ✓SQL-oriented query construction keeps database operations explicittypeormORM abstractions can place more distance between application code and SQL
- TypeScript Focus
- kyselyExplicitly emphasizes type-safe SQL queriestypeormTargets TypeScript and ES2023+ with ORM patterns
- Persistence Model
- kyselyLeaves entity and persistence architecture comparatively application-directedtypeorm ✓Offers a data-mapper ORM model for organizing persistence
- Query Construction
- kysely ✓Makes query composition the primary application-facing workflowtypeormProvides ORM-oriented persistence abstractions rather than centering its identity on a query builder
- Query Customization
- kysely ✓Typed query composition suits codebases with explicit SQL-oriented operationstypeormORM-centered workflow may be less direct when the main need is custom query composition
- Application Modeling
- kyselyDoes not position entity mapping as its core abstractiontypeorm ✓Data-mapper approach is designed around ORM persistence modeling
- Issue Backlog Context
- kysely ✓Fewer open issues in the supplied datatypeormMore open issues in the supplied data
- Repository Engagement
- kyselyFewer stars and forks in the supplied datatypeorm ✓More stars and forks in the supplied data
- Migration Between Styles
- kyselyMoving to it means expressing persistence as typed queriestypeormMoving to it means adopting ORM-oriented persistence patterns
- Reported Package Footprint
- kysely ✓Smaller reported unpacked and gzip bundle sizestypeormLarger reported unpacked and gzip bundle sizes
| Criteria | kysely | typeorm |
|---|---|---|
| Learning Curve | ✓ Focused query-builder abstraction for developers comfortable with SQL | Requires working within an ORM persistence model and its abstractions |
| NoSQL Targeting | Presented as a SQL query builder | ✓ Explicitly includes MongoDB in its supported database list |
| Core Abstraction | Typed SQL query builder centered on composing database queries | Data-mapper ORM with active-record also represented in its topics |
| Database Breadth | Topics identify SQL databases including PostgreSQL, MySQL, SQL Server, and SQLite | ✓ Explicitly lists SQL databases plus Oracle, SAP HANA, and MongoDB |
| SQL Transparency | ✓ SQL-oriented query construction keeps database operations explicit | ORM abstractions can place more distance between application code and SQL |
| TypeScript Focus | Explicitly emphasizes type-safe SQL queries | Targets TypeScript and ES2023+ with ORM patterns |
| Persistence Model | Leaves entity and persistence architecture comparatively application-directed | ✓ Offers a data-mapper ORM model for organizing persistence |
| Query Construction | ✓ Makes query composition the primary application-facing workflow | Provides ORM-oriented persistence abstractions rather than centering its identity on a query builder |
| Query Customization | ✓ Typed query composition suits codebases with explicit SQL-oriented operations | ORM-centered workflow may be less direct when the main need is custom query composition |
| Application Modeling | Does not position entity mapping as its core abstraction | ✓ Data-mapper approach is designed around ORM persistence modeling |
| Issue Backlog Context | ✓ Fewer open issues in the supplied data | More open issues in the supplied data |
| Repository Engagement | Fewer stars and forks in the supplied data | ✓ More stars and forks in the supplied data |
| Migration Between Styles | Moving to it means expressing persistence as typed queries | Moving to it means adopting ORM-oriented persistence patterns |
| Reported Package Footprint | ✓ Smaller reported unpacked and gzip bundle sizes | Larger reported unpacked and gzip bundle sizes |
kysely is a TypeScript SQL query builder for teams that want typed access to relational databases without adopting an entity-oriented ORM model. Its focus is expressing SQL operations through a typed query API while leaving schema design and much of the persistence architecture in the application’s hands, making it a natural fit for developers who already think in tables, joins, and SQL.
typeorm is a data-mapper ORM for TypeScript and ES2023+ applications that want a higher-level model for representing and persisting domain data. Its stated database coverage includes MySQL, MariaDB, PostgreSQL, Microsoft SQL Server, Oracle, SAP HANA, SQLite, and MongoDB, so it is suited to projects that value ORM abstractions and a broad range of database choices over a query-builder-centered workflow.
The key architectural difference is what developers work with day to day: kysely builds typed queries, whereas typeorm frames persistence around ORM patterns such as data mapper and active record. With kysely, query construction is the central operation and the resulting SQL-oriented intent stays visible; with typeorm, application code can use ORM abstractions to manage entities and their persistence. That distinction affects how naturally custom joins and database-specific query logic fit into each codebase.
Their extension approaches follow those different centers of gravity. kysely’s query-builder design makes query composition the primary seam for organizing database operations, while typeorm’s ORM approach organizes work around its persistence model and supported database integrations. The supplied information does not specify particular plugin or middleware APIs, so teams should compare the concrete extension points they need rather than assume either package has a particular hook or plugin capability.
typeorm offers a more substantial conceptual surface because developers must decide how its ORM model fits their application, while kysely keeps the central abstraction focused on typed SQL query construction. Both are explicitly TypeScript-oriented, but they serve different TypeScript workflows: kysely emphasizes type safety in queries, and typeorm describes itself as a TypeScript data-mapper ORM. Developers comfortable reasoning directly about SQL may find kysely’s model more direct; teams seeking ORM-oriented data handling may prefer typeorm’s abstractions.
For applications where dependency footprint and shipped bundle size matter, the supplied figures favor kysely: its unpacked size is 1.8 MB and its gzip bundle size is 39.5 kB, compared with typeorm at 21.8 MB and 147.6 kB. These measurements do not establish runtime query speed or performance under a particular workload, so they should inform packaging decisions rather than be treated as a benchmark. kysely is the more compact option on the reported size measures.
Choose kysely when the application needs type-safe SQL composition, developers want queries to remain explicit, or keeping the database layer comparatively focused is a priority. Choose typeorm when the project is designed around an ORM data-mapper or active-record style and its stated database range, including MongoDB and Oracle, is relevant. The decision should follow the desired persistence model, not download counts or repository attention alone.
Migration and long-term maintenance depend on how tightly application code adopts each abstraction. Moving from kysely to typeorm would mean introducing an ORM persistence model where query-builder operations had been central; moving in the other direction would require expressing persistence work as typed queries rather than relying on ORM patterns. kysely has fewer open issues in the supplied data, while typeorm has more stars and forks; those figures are context, not guarantees about resolution time or future maintenance.
A practical edge case is database breadth: typeorm explicitly lists MongoDB, Oracle, and SAP HANA among its supported targets, whereas kysely’s listed topics emphasize SQL databases such as PostgreSQL, MySQL, Microsoft SQL Server, and SQLite. For a project targeting those specifically named typeorm databases, verify the required capabilities before choosing a SQL query builder. For a relational application where the team prioritizes typed query construction and a smaller reported footprint, kysely is the more aligned fit.
CORRECTIONS
Spot wrong data here?Spot wrong data on this page?
A short note helps us fix it.A short note helps us fix it. We read every one; confirmed fixes ship in the next nightly build.
Anonymous · No account · No email back