Fully-feature modularized GraphQL Server boilerplate with production-ready containerized workflow.
- Easiest way to run a GraphQL server: Sensible defaults & includes everything you need with minimal setup.
- Practical: Built-in scripts to facilitate common workflows.
- Production-ready: Containerized with nginx and letsencrypt configuration.
- Testability: Including complete testing environment wih modular package.
This project is based on the following libraries & tools:
graphql-yoga
: Fully-featured GraphQL server frameworkgraphql-shield
: GraphQL Server permissions as another layer of abstraction!merge-graphql-schemas
: A utility library to facilitate merging of modularized GraphQL schemas and resolver objects.prisma
: GraphQL ORM-like* layer between between your GraphQL API and databaseprisma-binding
: GraphQL Binding for Prisma services (GraphQL Database)graphql-playground
: Interactive GraphQL IDE
Create a .env
file in the root directory of your project. Add
environment-specific variables on new lines in the form of NAME=VALUE
.
See .env.example
for example.
To clean the project run following command(s).
bash scripts/clean-local.sh
Note: Recommended for the first run.
- (Optional) Clean project, follow Clean Project topic above. (Recommended if you run for the first time).
- Start GraphQL server:
bash scripts/run-local.sh
- (Optional) Start GraphQL Playground:
NOTE: To use desktop version of GraphQL Playground, download it from releases or install via Homebrew.
bash scripts/graphql-playground.sh
NOTE: This is a recommended method to run local dev server, but there is also an alternative method to optimise development cycle.
Seed initial data to database for development.
- Make sure you have run the project once.
- Recommended for an empty database. If database is dirty, there might occurs some error during the seed.
- Seed the database:
bash scripts/run-seed.sh
This method is recommended for advanced docker user. See setup-dev.sh
, run-dev.sh
for more details of the scripts.
- Make sure you have run the project once, or run the following command to install dependencies.
yarn
- Setting up dev environment:
bash scripts/setup-dev.sh
- Run the server:
NOTE: Debugger listening on port 9229, repeat step 3 to run server again
bash scripts/run-dev.sh # OR bash scripts/run-debug.sh # To run server in debug mode
- Make sure you have run the project once.
- Setting up test environment:
bash scripts/setup-test.sh
- Run the test:
NOTE: Repeat step 3 to run test again
bash scripts/run-test.sh # OR bash scripts/run-watch-test.sh # To run test in watch mode
docker-compose -f docker-compose.yml -f docker-compose.prod.yml build --force-rm
docker-compose -f docker-compose.yml -f docker-compose.prod.yml up -d
Contributions are welcome and extremely helpful 🙌, feel free to make discussions and open a pull request.
This project use angular commit message guidelines, please refer to the guildlines for more information.
Copyright 2018 Jakpat Mingmongkolmitr
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.