AeroGraphQL is not yet ready for production and currently under development.

What is AeroGraphQL ?

AeroGraphQL is a small and opinionated Typescript toolkit to create GraphQL server using a declarative approach.

What does it look like ?

The goal of AeroGraphQL is to automaticly create the GraphQL schema while you write your Typescript business objects, so you don’t need to maintain a separate GraphQL schema definition aside of their implementations.

First, define your schema object’s types using Typescript annotation:

1
2
3
4
5
6
@ObjectDefinition( { name: 'User' } )
export class UserType {
@Field( { type: 'ID' } ) id: string;
@Field( ) name: String;
@Field( { nullable: true }) description: String;
}

Then implement your resolver:

1
2
3
4
5
6
7
8
9
10
@ObjectImplementation( { name: 'RootQuery' } )
export class RootQuery {

constructor( private userService: UserService ) { }

@Resolver( { type: UserType } )
user( @Arg() name: String ) {
return this.userService.fetchTheUserFromDB( name );
}
}

Compose your Schema:

1
2
3
4
5
6
@Schema( {
rootQuery: 'RootQuery',
components:[ UserType, RootQuery ]
} )
export class MySchema extends BaseSchema {
}

Then inject this schema in your favorite GraphQL server.
Apollo Server with Express in this case:

1
2
3
4
5
6
let mySchema = new MySchema();
this.app = express();
this.app.use( '/graphql', bodyParser.json(), graphqlExpress( { schema: mySchema.graphQLSchema } );
this.app.listen( config.get( 'server.port' ), () => {
console.log( 'Up and running !' );
} );

This server will expose the following GraphQL schema:

1
2
3
4
5
6
7
8
9
10
11
12
13
type User {
id: ID!
name: String!
description: String
}

type RootQuery {
user( name: String! ): User!
}

schema {
query: RootQuery
}

With each resolvers automaticaly wired to their implementations.

Where to go next ?

Follow the Getting started guide to learn more about AeroGraphQL !
or
Checkout the API references.