|
| 1 | +<h1 align="center"><strong>Boilerplate for a Minimal GraphQL Server w/ TypeScript</strong></h1> |
| 2 | + |
| 3 | +<br /> |
| 4 | + |
| 5 | +<div align="center"><img src="https://imgur.com/1MfnLVl.png" /></div> |
| 6 | + |
| 7 | +<div align="center"><strong>🚀 Bootstrap your GraphQL server within seconds</strong></div> |
| 8 | +<div align="center">Minimal starter kit for a flexible GraphQL server for TypeScript - based on best practices from the GraphQL community.</div> |
| 9 | + |
| 10 | +## Features |
| 11 | + |
| 12 | +- **Scalable GraphQL server:** The server uses [`graphql-yoga`](https://github.com/prisma/graphql-yoga) which is based on Apollo Server & Express |
| 13 | +- **Tooling**: Out-of-the-box support for [GraphQL Playground](https://github.com/prisma/graphql-playground) & [query performance tracing](https://github.com/apollographql/apollo-tracing) |
| 14 | +- **Simple Hello World example:** Where it either returns `Hello <name>!` or `Hello World!` if no name argument is provided. |
| 15 | +- **No configuration overhead**: Preconfigured [`graphql-config`](https://github.com/prisma/graphql-config) setup |
| 16 | + |
| 17 | +Read more about the idea behind GraphQL boilerplates [here](https://blog.graph.cool/graphql-boilerplates-graphql-create-how-to-setup-a-graphql-project-6428be2f3a5). |
| 18 | + |
| 19 | +## Requirements |
| 20 | + |
| 21 | +You need to have the [GraphQL CLI](https://github.com/graphql-cli/graphql-cli) installed to bootstrap your GraphQL server using `graphql create`: |
| 22 | + |
| 23 | +```sh |
| 24 | +npm install -g graphql-cli |
| 25 | +``` |
| 26 | + |
| 27 | +## Getting started |
| 28 | + |
| 29 | +```sh |
| 30 | +# 1. Bootstrap GraphQL server in directory `my-app`, based on `typescript-basic` boilerplate |
| 31 | +graphql create my-app --boilerplate typescript-minimal |
| 32 | + |
| 33 | +# 2. Run yarn install or npm install |
| 34 | + |
| 35 | +# 3. Navigate to the new project |
| 36 | +cd my-app |
| 37 | + |
| 38 | +# 4. Start server (runs on http://localhost:4000) and open GraphQL Playground |
| 39 | +yarn dev |
| 40 | +``` |
| 41 | + |
| 42 | + |
| 43 | + |
| 44 | +## Documentation |
| 45 | + |
| 46 | +### Commands |
| 47 | + |
| 48 | +* `yarn start` or `npm run start` starts GraphQL server on `http://localhost:4000` |
| 49 | +* `yarn dev` or `npm run dev` starts GraphQL server on `http://localhost:4000` _and_ opens GraphQL Playground |
| 50 | + |
| 51 | +### Project structure |
| 52 | + |
| 53 | +| File name | Description <br><br>| |
| 54 | +| :-- | :-- | |
| 55 | +| `└── src ` (_directory_) | _Contains the source files for your GraphQL server_ | |
| 56 | +| ` ├── index.ts` | The entry point for your GraphQL server | |
| 57 | + |
| 58 | + |
| 59 | +## Contributing |
| 60 | + |
| 61 | +The GraphQL boilerplates are maintained by the GraphQL community, with official support from the [Apollo](https://dev-blog.apollodata.com) & [Graphcool](https://blog.graph.cool/) teams. |
| 62 | + |
| 63 | +Your feedback is **very helpful**, please share your opinion and thoughts! If you have any questions or want to contribute yourself, join the [`#graphql-boilerplate`](https://graphcool.slack.com/messages/graphql-boilerplate) channel on our [Slack](https://graphcool.slack.com/). |
0 commit comments