@twinlogix/typetta




Node.js ORM written in TypeScript for type lovers.

Codacy grade .

Docs   -   Examples


Typetta is an open-source ORM written in TypeScript that aims to allow seamless access to data in a typed fashion to all main SQL databases (MySQL, PostgreSQL, Microsoft SQL Server, SQLLite3, CockroachDB, MariaDB, Oracle e Amazon Redshift) and also to the NoSQL database MongoDB.

Typetta is pluggable into any TypeScript backend (including serverless applications and microservices) but in terms of gain we totally suggest using it in all GraphQL backends, because... because we simply love GraphQL.

How do I use Typetta?

With Typetta everything revolves around the data model, the entities that describe the application domain and all underlying relationships between them. This model is described in standard GraphQL, using all basic concepts (scalars, types, enumerations, etc...) and some custom directives.

Starting from the model output of the domain analysis, Typetta provides a range of code generators for:

  • Type definitions in TypeScript language for each entity in the model.

  • Data Access Object (aka DAO) for each entity type that has a corresponding data source. Each DAO is an object that the developer can also query with advanced CRUD operations.

  • An Entity Manager where the developer can configure each data source and retrieve the reference of any DAO.

  • A completely auto-generated GraphQL Endpoint with advanced CRUD operations to access and modify data.

Main Functionalities

Below is a brief description of what makes Typetta awesome:

  • Complete support of main SQL databases and also MongoDB.
  • Multiple databases, including the ability to cross query different databases.
  • Multiple connections and connection pooling.
  • Entity relationships: 1-1, 1-n, n-m.
  • Dynamic typing and corresponding data projections.
  • Pagination.
  • Can be extended using middlewares.
  • Customised scalars and serialisation of the database.
  • Autogenerated IDs.
  • Validation rules.
  • Virtual, computed and calculated fields.
  • Aggregation queries.
  • Ability to build custom queries.
  • Define data access security policies.
  • Embedded documents supported on MongoDB as well as SQL.
  • Automated code generation.
  • Effortless integration with GraphQL backends.
  • Optional automated GraphQL Endpoint generation for CRUD operations.
  • Transactions.
  • Logging.
  • Mocking.
  • Auditing.
  • Multi-tenancy partitioning.
  • Soft-delete.

Why Typetta?

Typetta fulfills the need of having a typed ORM connected to SQL and NoSQL databases designed with productivity and flexibility in mind.

The philosophy behind Typetta components has been to ensure ease of use and optimisation of development time, adding complexity (with direct access to data source) only when strictly needed.

In case you are still unsure, why use Typetta instead of other ORMs?

  • It's the ONLY TypeScript ORM that has full support for SQL and MongoDB databases.

  • A very strict typing system that 100% leverages TypeScript in providing types as responses based on the requested data type.

  • Using standard GraphQL as data modeling language opens the door to a whole set of instruments and third party tools.

Generated using TypeDoc