reflect-metadata
TypeGraphQL
reflect-metadata | TypeGraphQL | |
---|---|---|
4 | 32 | |
3,215 | 8,043 | |
- | - | |
7.2 | 8.4 | |
9 months ago | 24 days ago | |
TypeScript | TypeScript | |
Apache License 2.0 | MIT License |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
reflect-metadata
-
Dynamic NestJS Listeners: Discover the Power of Lazy Loading
We could use the reflect-metadata library to store the metadata and then scan it manually to replace the placeholders with actual values, but there is a better way.
- TypeScript please give us types
-
Using modern decorators in TypeScript
Second, TypeScript 5.0 cannot emit decorator metadata. Subsequently, it doesn’t integrate with the Reflect API and won’t work with the reflect-metadata npm package.
-
Deconstructing an Object Relationship Mapper (ORM) in Typescript
Database columns will be mapped to domain object properties using decorators. This will include relationships and enum types. reflect-metadata stores metadata about the classes and properties. Most of the work is a simple map for each class, renaming db column properties to domain model properties and vice versa. Reflect.defineProperty holds a list of field metadata on the target class. This is where more database ORM logic could live in the future such as column type, length, etc. A base domain model entity will use this metadata to map the models appropriately.
TypeGraphQL
-
Starting the Console front-end for Rainbow Platform
Take GraphQL as an example—REST APIs have a similar challenge, often using something like OpenAPI as the "schema." If you want your code to be the source of truth, you can use something like TypeGraphQL, which generates the GraphQL schema based on decorators in your classes. On the other hand, you can use the reference GraphQL server implementation (graphql-js) with raw Schema Definition Files as your contract—then generate TypeScript types using something like GraphQL Codegen.
-
Why, after 6 years, I'm over GraphQL
All good points! We built Yates (https://github.com/cerebruminc/yates) to solve the authz problem.
Yates implements Postgres RLS on top of Prisma, which we use as our ORM, and then our GraphQL schema is generated using TypeGraphQL (https://typegraphql.com/). Overall, it's a very nice setup and allows us to be versatile on the client side while still having strong authentication integrity.
-
Cerbos + GraphQL: Do not reinvent user permissions
In this tutorial, we're building a simple application which uses Cerbos inside of a GraphQL server. The server is written in typescript and uses type-graphql to create the schema and resolvers, and TypeDI to handle dependency injection.
-
Using modern decorators in TypeScript
Using decorators required setting an --experimentalDecorators experimental compiler flag. Several popular TypeScript libraries, such as type-graphql and inversify, rely on this implementation.
- help wanted: Typescript GraphQL Types Response
-
Build a Next App with a full GraphQL API using just a JSON or CSV file
TypeGraphQL
-
What to use with Apollo Server v4 to achieve type-safety?
Have you tried TypeGraphQL v2 (it's in beta). Some in this thread have reported success with it.
-
Apollo Server v4 Breaking Changes. Time to move away?
When moving away from Apollo Server, and you're looking for a replacement built with JavaScript or TypeScript, let me give you some options. If you want to keep building your GraphQL API schema first, you might want to consider Mercurius (which relies on Fastify) or GraphQL Yoga. If you're going to build your GraphQL API code or resolver first, have a look at TypeGraphQL or Nexus. Alternatively, there are great GraphQL-as-a-Service solutions such as StepZen in case you no longer want to build, maintain and host your own GraphQL API.
-
A journey towards a type-safe GraphQL API server
There are two main approaches to keeping the types of the GraphQL schema and entities in business logic in sync. You can generate the schema based on your TypeScript code (e.g. TypeGraphQL), or you can generate types based on your schema (e.g. GraphQL Code Generator). We opted for the latter since it slotted right into our existing GraphQL server implementation using Apollo Server.
-
Do you use a tool for generating your GraphQL schema, or do you write it as part of your development process?
I've used tools (e.g. TypeGraphQL) in the past, and for smaller schemas I've just manually written the schema.
What are some alternatives?
protobuf-ts - Protobuf and RPC for TypeScript
graphql-code-generator - A tool for generating code based on a GraphQL schema and GraphQL operations (query/mutation/subscription), with flexible support for custom plugins.
sequelize-typescript-decorators - Sequelize (SQL ORM for Node) Typescript Decorator that simplifies declarations of Sequelize models...
nexus - Code-First, Type-Safe, GraphQL Schema Construction
di-compiler - A Custom Transformer for Typescript that enables compile-time Dependency Injection
graphql-shield - 🛡 A GraphQL tool to ease the creation of permission layer.
arktype - TypeScript's 1:1 validator, optimized from editor to runtime
Nest - A progressive Node.js framework for building efficient, scalable, and enterprise-grade server-side applications with TypeScript/JavaScript 🚀
ferocity - Write Java expression trees, statements, methods and classes with a LISP-like internal DSL
pothos - Pothos GraphQL is library for creating GraphQL schemas in typescript using a strongly typed code first approach
schemats - Generate typescript interface definitions from SQL database schema
Neo4j - Graphs for Everyone