🚀 Bootstrap your GraphQL server within seconds
Advanced starter kit for a flexible GraphQL server for Node.js - based on best practices from the GraphQL community.
-
Scalable GraphQL server: The server uses
graphql-yoga
which is based on Apollo Server & Express -
MongoDB: The most popular database for modern apps
MongoDB
-
Interactions: Sample BREAD of 3 model (posts, comments, users)
-
Relations: All possible relations are used, subdocument & reference
-
Tooling: Out-of-the-box support for GraphQL Playground
-
Extensible: Simple and flexible thanks to mongoose models – easy to adjust and extend
-
Configuration: Preconfigured
-
Architecture: Component Based Architecture
-
Mongoose: The elegant mongodb object modeling for node.js
Demonstration of this repo GraphQL Boilerplate hosted on live server graphql-boilerplate.
# 1 Rename .env.example as .env
# 2 Change MONGODB_URI by your DB uri
# 3 Navigate to the folder
cd graphql-boilerplate
# 4.Run
npm install
# 5.Start server using node src/index.js (runs on http://localhost:4000) and open in GraphQL Playground
# Get all posts with related comments and user
query {
posts {
id
published
title
content
comments {
content
}
user{
name
email
}
}
}
# Create new post request
mutation{
createPost(
user_id: "5e14dc6c5c2cb87b05f9197a"
title: "Love Node.js"
content: "Node.js is most powerfull language"
){
id
title
content
}
}
npm run start
starts GraphQL server onhttp://localhost:4000
File name | Description |
---|---|
└── src (directory) |
Contains the source files for your GraphQL server |
├── index.js |
The entry point for your GraphQL server |
- Clone it (https://github.com/abdodeve/graphql-boilerplate.git)
- Create your feature branch (
git checkout -b feature/featureName
) - Commit your changes (
git commit -am 'Add some fooBar'
) - Push to the branch (
git push origin feature/featureName
) - Create a new Pull Request.