Ent Framework is a TypeScript-first library designed for interacting with PostgreSQL databases, presenting a graph-like representation of entities rather than a traditional ORM approach. It is currently stable at version 2.26.1 and appears to be actively maintained with regular updates. Key differentiators include its robust solution for the 'N+1 selects' problem through query batching and coalescing, built-in support for microsharding and intelligent replication lag tracking to optimize read operations, and a comprehensive row-level security (privacy layer) system that defines access based on entity relationships. The framework also emphasizes immutability for entity properties and offers a pluggable architecture, allowing integration into existing database setups. It aims to simplify scaling and security concerns for complex business logic by abstracting away much of the underlying SQL complexities.
npm install ent-frameworkVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates defining a basic 'User' Ent class, initializing the EntContext, creating a new user entity, and then loading it by ID, showcasing fundamental interaction patterns.
Review the changelog and migration guides for the specific version you are upgrading to. Pay close attention to changes in decorators, field types, and `EntContext` configuration options.
Ensure `"experimentalDecorators": true` and `"emitDecoratorMetadata": true` are set under `compilerOptions` in your `tsconfig.json`.
Always use the provided `EntContext` and `Ent` methods for data retrieval and manipulation. Understand the framework's intended data access patterns to ensure optimal performance.
Implement a robust schema migration strategy (e.g., using a separate migration tool or the framework's recommended approach if available) and test thoroughly in non-production environments before deploying schema changes.
Thoroughly understand the sharding key definitions, replica lag tolerances, and routing logic. Implement comprehensive integration tests to validate data consistency and correct routing across your sharded and replicated database cluster.
Add or ensure `"experimentalDecorators": true` and `"emitDecoratorMetadata": true` are in `compilerOptions` in `tsconfig.json`.
Verify the `connectionUri` in `EntContext` initialization. Ensure the PostgreSQL server is running, accessible from the application's host, and that firewall rules permit the connection. Check user credentials and database existence.
Run database migrations to create or update the tables and columns corresponding to your Ent definitions. Ensure your Ent class names correctly map to table names (considering potential naming conventions).
No dependency data recorded yet.