Log in to GraphQL Editor
External Tools

Model types for popular databases | GraphQL CLI

$ gecli codegen models

Generate TypeScript Models from GraphQL types. They are very handy to use with popular databases.

type Person {
  firstName: String!
  lastName: String!
  email: String
  phone: String
  friends: [Person!]!

will be transformed to a model file

import type { ModelTypes } from '@/zeus';
export type Person = ModelTypes['Person'];

later on you may want to transform it so that it is a database model

import type { ModelTypes } from '@/zeus';
export type Person = Omit<ModelTypes['Person'], 'friends'> & {
  friends: string[];

You can probably see what the concept is about now.


Here is an example of how you can use your model in MongoDB: