Re:Show HN: PgTyped – Typesafe SQL in TypeScript and Postgres
by noodlesUK on Tuesday May 26, 2020 @05:59AM
(#23309115)
The system that I’ve most enjoyed using recently has been hasura. It’s basically a plug and play graphql api that sits on top of a Postgres db. I love it. You can call your database directly from your clients, with row level permissions, and real time subscriptions. It’s just great.
hasura.io
And the real issue is how to define and where to place a single source of truth for the schema an operations. So far we saw approaches where:
- GraphQL schema is generated from SQL tables. Makes total sense for a project or a company that looks to capitalize on customers with existing databases (e.g., PostGraphile, Hasura);
- SQL schema is generated from a GraphQL schema;
- SQL schema and TypeScript CRUD resolvers are generated from GraphQL schema (graphback);
- a language is introduced and GraphQL and SQL are generated from that language (Prisma);
- a library and a set of decorators are used to define both GraphQL schema and a typed ORM schema within a standard language (e.g, TypeGraphQL + TypeScript + some ORM such as TypeORM).