Inverse Model mounts a GraphQL API over an existing database from just its connection string.
Documentation · Documentación en español
npm install @nestjs-modules/inverse-modelPlus the driver of your database: pg, mysql2, mssql or mongodb. See Getting started for the peer dependencies.
import { Module } from '@nestjs/common';
import { InverseModelModule } from '@nestjs-modules/inverse-model';
@Module({
imports: [InverseModelModule.forRoot({ url: process.env.DATABASE_URL! })],
})
export class AppModule {}On start it reads every table, key and foreign key of the database, and serves a GraphQL API with filters, pagination, relations and every mutation, for PostgreSQL, MySQL, MariaDB, SQL Server and MongoDB.
Everything else is in the documentation: the generated API, security, caching, extending and all the options.
See Contributing.