-
-
Notifications
You must be signed in to change notification settings - Fork 155
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
2,169 additions
and
160 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,58 +1,60 @@ | ||
# GiraphQL SchemaBuilder | ||
## GiraphQL - A plugin based GraphQL schema builder for typescript | ||
|
||
GiraphQL is library for creating GraphQL schemas in typescript using a strongly typed code first | ||
approach. The GiraphQL schema builder makes writing schemas easy by providing a simple clean API | ||
with helpful auto-completes, and removing the need for compile steps or defining the same types in | ||
multiple files. | ||
GiraphQL makes writing graphql schemas in typescript easy, fast and enjoyable. The core of GiraphQL | ||
adds 0 overhead at runtime, and has `graphql` as its only dependency. | ||
|
||
GiraphQL works in Node, Deno, or even the browser. | ||
By leaning heavily on typescripts ability to infer types, GiraphQL is the most type-safe way of | ||
writing GraphQL schemas in typescript/node while requiring very few manual type definitions and no | ||
code generation. | ||
|
||
GiraphQL has a unique and powerful plugin system that makes every plugin feel like its features are | ||
built into the core library. Plugins can extend almost any part of the API by adding new options or | ||
methods that can take full advantage of GiraphQLs type system. | ||
|
||
## Hello, World | ||
|
||
```typescript | ||
import SchemaBuilder from '@giraphql/core'; | ||
import { ApolloServer } from 'apollo-server'; | ||
import SchemaBuilder from '@giraphql/core'; | ||
|
||
const builder = new SchemaBuilder({}); | ||
|
||
builder.queryType({ | ||
fields: (t) => ({ | ||
hello: t.string({ | ||
args: { | ||
name: t.arg.string({}), | ||
}, | ||
resolve: (parent, { name }) => `hello, ${name || 'World'}`, | ||
}), | ||
fields: (t) => ({ | ||
hello: t.string({ | ||
args: { | ||
name: t.arg.string({}), | ||
}, | ||
resolve: (parent, { name }) => `hello, ${name || 'World'}`, | ||
}), | ||
}), | ||
}); | ||
|
||
const server = new ApolloServer({ | ||
schema: builder.toSchema({}), | ||
}); | ||
|
||
server.listen(3000); | ||
new ApolloServer({ | ||
schema: builder.toSchema({}), | ||
}).listen(3000); | ||
``` | ||
|
||
## Full docs available at https://giraphql.com | ||
|
||
## Development | ||
## Plugins that make GiraphQL even better | ||
|
||
- ## [Scope Auth](plugins/scope-auth.md) | ||
Add global, type level, or field level authorization checks to your schema | ||
- ## [Validation](plugins/validation.md) | ||
Validating your inputs and arguments | ||
- ## [Dataloader](plugins/dataloader.md) | ||
Quickly define data-loaders for your types and fields to avoid n+1 queries. | ||
- ## [Relay](plugins/relay.md) | ||
- Easy to use builder methods for defining relay style nodes and connections, and helpful utilities | ||
for cursor based pagination. | ||
- ## [Simple Objects](plugins/simple-objects.md) | ||
Define simple object types without resolvers or manual type definitions. | ||
- ## [Mocks](plugins/mocks.md) | ||
Add mock resolver for easier testing | ||
- ## [Sub-Graph](plugins/sub-graph.md) | ||
Build multiple subsets of your graph to easily share code between internal and external APIs. | ||
- ## [Directives](plugins/directives.md) | ||
Integrate with existing schema graphql directives in a type-safe way. | ||
- ## [Smart Subscriptions](plugins/smart-subscriptions.md) | ||
Make any part of your graph subscribable to get live updates as your data changes. | ||
|
||
### Setup | ||
|
||
After cloning run | ||
|
||
```bash | ||
yarn install | ||
yarn prepare | ||
yarn build | ||
``` | ||
|
||
### Scripts | ||
|
||
- `yarn prepare`: re-create all the config files for tools used in this repo | ||
- `yarn build`: builds .js and .d.ts files | ||
- `yarn clean`: removes all build artifacts for code and docs | ||
- `yarn lint {path to file/directory}`: runs linter (eslint) | ||
- `yarn jest {path to file/directory}`: run run tests | ||
- `yarn test`: runs typechecking, lint, and tests | ||
- `yarn prettier`: formats code and docs | ||
- `yarn type`: run typechecking | ||
## Full docs available at https://giraphql.com |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,38 @@ | ||
# Table of contents | ||
|
||
* [Overview](README.md) | ||
* [Guide](guide/README.md) | ||
* [Object Types](guide/objects.md) | ||
* [SchemaBuilder](guide/schema-builder.md) | ||
* [Fields](guide/fields.md) | ||
* [Args](guide/args.md) | ||
* [Context object](guide/context.md) | ||
* [Input Objects](guide/inputs.md) | ||
* [Enums](guide/enums.md) | ||
* [Scalars](guide/scalars.md) | ||
* [Interfaces](guide/interfaces.md) | ||
* [Unions](guide/unions.md) | ||
* [Using Plugins](guide/using-plugins.md) | ||
* [App layout](guide/app-layout.md) | ||
* [Printing Schema](guide/printing-schemas.md) | ||
* [Changing Default Nullability](guide/changing-default-nullability.md) | ||
* [Writing Plugins](guide/writing-plugins.md) | ||
* [Deno](guide/deno.md) | ||
* [Plugins](plugins/README.md) | ||
* [Auth Plugin](plugins/scope-auth.md) | ||
* [Mocks Plugin](plugins/mocks.md) | ||
* [Relay Plugin](plugins/relay.md) | ||
* [Simple Objects Plugin](plugins/simple-objects.md) | ||
* [Smart Subscriptions Plugin](plugins/smart-subscriptions.md) | ||
* [SubGraph Plugin](plugins/sub-graph.md) | ||
* [Directives Plugin](plugins/directives.md) | ||
* [Validation Plugin](plugins/validation.md) | ||
* [API](api/README.md) | ||
* [SchemaBuilder](api/schema-builder.md) | ||
* [FieldBuilder](api/field-builder.md) | ||
* [ArgBuilder](api/arg-builder.md) | ||
* [InputFieldBuilder](api/input-field-builder.md) | ||
* [Design](design.md) | ||
* [Migrations](migrations/README.md) | ||
* [v2.0](migrations/2.0.md) | ||
|
||
- [Overview](README.md) | ||
- [Guide](guide/README.md) | ||
- [Object Types](guide/objects.md) | ||
- [SchemaBuilder](guide/schema-builder.md) | ||
- [Fields](guide/fields.md) | ||
- [Args](guide/args.md) | ||
- [Context object](guide/context.md) | ||
- [Input Objects](guide/inputs.md) | ||
- [Enums](guide/enums.md) | ||
- [Scalars](guide/scalars.md) | ||
- [Interfaces](guide/interfaces.md) | ||
- [Unions](guide/unions.md) | ||
- [Using Plugins](guide/using-plugins.md) | ||
- [App layout](guide/app-layout.md) | ||
- [Printing Schema](guide/printing-schemas.md) | ||
- [Changing Default Nullability](guide/changing-default-nullability.md) | ||
- [Writing Plugins](guide/writing-plugins.md) | ||
- [Deno](guide/deno.md) | ||
- [Plugins](plugins/README.md) | ||
- [Auth](plugins/scope-auth.md) | ||
- [Dataloader](plugins/dataloader.md) | ||
- [Directives](plugins/directives.md) | ||
- [Mocks](plugins/mocks.md) | ||
- [Relay](plugins/relay.md) | ||
- [Simple Objects](plugins/simple-objects.md) | ||
- [Smart Subscriptions](plugins/smart-subscriptions.md) | ||
- [SubGraph](plugins/sub-graph.md) | ||
- [Validation](plugins/validation.md) | ||
- [API](api/README.md) | ||
- [SchemaBuilder](api/schema-builder.md) | ||
- [FieldBuilder](api/field-builder.md) | ||
- [ArgBuilder](api/arg-builder.md) | ||
- [InputFieldBuilder](api/input-field-builder.md) | ||
- [Design](design.md) | ||
- [Migrations](migrations/README.md) | ||
- [v2.0](migrations/2.0.md) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,21 @@ | ||
# Plugins | ||
|
||
- [`@giraphql/plugin-scope-auth`](scope-auth.md): A plugin for adding authorization checks | ||
throughout your schema | ||
- [`@giraphql/plugin-relay`](relay.md): A plugin for adding builder methods for defining relay style | ||
nodes and connections, and some helpful utilities for cursor based pagination | ||
- [`@giraphql/plugin-smart-subscriptions`](smart-subscriptions.md): A plugin for a more graph | ||
friendly way of defining subscriptions. | ||
- [`@giraphql/plugin-simple-objects`](simple-objects.md): A plugin for creating simple objects and | ||
interfaces without resolvers or arguments. | ||
- [`@giraphql/plugin-mocks`](mocks.md): A plugin for mocking out resolvers in your schema. | ||
- [`@giraphql/plugin-sub-graph`](sub-graph.md): A plugin for creating sub selections of your graph. | ||
- [`@giraphql/plugin-directives`](directives.md): A plugin for using directives with GiraphQL | ||
schemas. | ||
- [`@giraphql/plugin-validation`](validation.md): A plugin for validating arguments. | ||
- ## [Scope Auth](./scope-auth.md) | ||
Add global, type level, or field level authorization checks to your schema | ||
- ## [Validation](./validation.md) | ||
Validating your inputs and arguments | ||
- ## [Dataloader](./dataloader.md) | ||
Quickly define data-loaders for your types and fields to avoid n+1 queries. | ||
- ## [Relay](./relay.md) | ||
- Easy to use builder methods for defining relay style nodes and connections, and helpful utilities | ||
for cursor based pagination. | ||
- ## [Simple Objects](./simple-objects.md) | ||
Define simple object types without resolvers or manual type definitions. | ||
- ## [Mocks](./mocks.md) | ||
Add mock resolver for easier testing | ||
- ## [Sub-Graph](./sub-graph.md) | ||
Build multiple subsets of your graph to easily share code between internal and external APIs. | ||
- ## [Directives](./directives.md) | ||
Integrate with existing schema graphql directives in a type-safe way. | ||
- ## [Smart Subscriptions](./smart-subscriptions.md) | ||
Make any part of your graph subscribable to get live updates as your data changes. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.