Giter Club home page Giter Club logo

graphql-starter-kit's Introduction

GraphQL Starter Kit  

Project template for authoring GraphQL server applications with Node.js 7+ and JavaScript (demo). You can use it either as a playground or a base for your next Node.js-based backend project.

Directory Layout

.
├── /build/                     # The compiled output (via Babel)
├── /migrations/                # Database schema migrations
├── /node_modules/              # Project dependencies (npm modules)
├── /scripts/                   # Build automation scripts
├── /src/                       # Node.js application source files
│   ├── /db/                    # Database access methods and connection pooling
│   ├── /passport/              # Passport.js authentication strategies
│   ├── /routes/                # Express routes, e.g. /login/facebook
│   ├── /types/                 # GraphQL types /w resolve functions
│   │   ├── /User.js            # User account (id, email, etc.)
│   │   ├── /Viewer.js          # The top-level GraphQL object type
│   │   └── /...                # etc.
│   ├── /utils/                 # Utility functions
│   ├── /app.js                 # Express application
│   ├── /schema.js              # GraphQL schema
│   └── /server.js              # Node.js server (entry point)
├── /test/                      # Unit, integration and load tests
├── .env                        # Application settings for the dev environment
├── package.json                # The list of project dependencies
└── yarn.lock                   # Fixed versions of all the dependencies

Prerequisites

Getting Started

Just clone the repo and start hacking:

git clone -o graphql-starter-kit -b master --single-branch \
   https://github.com/kriasoft/graphql-starter-kit.git api.example.com
cd api.example.com
yarn install                    # Install project dependencies. Alternatively, npm install
npm run db:create               # Create a new database (see .env/DATABASE_URL)
npm run db:migrate              # Migrate database schema to the latest version
npm run start                   # Launch the app. Alternatively, node scripts/start.js

The GraphQL server should become available at http://localhost:5000/ (live demo).

If you just need to build the project without launching a dev server, run one of these two commands:

npm run build                   # Compiles the app into the /build folder
npm run build:watch             # Compiles the app and starts watching for changes

Database

The following scripts can be used to transfer your existing database into another state and vise versa. Those state transitions are saved in migration files (/migrations/*.js), which describe the way how to get to the new state and how to revert the changes in order to get back to the old state.

npm run db:create               # Create a new database
npm run db:drop                 # Drop the database
npm run db:version              # Print database schema version
npm run db:migrate              # Migrate database schema to the latest version
npm run db:migrate:undo         # Rollback the latest migration
npm run db:migration <name>     # Create a new migration from the template (see /migrations folder)
npm run db:seed                 # Import reference data

Testing

npm run lint                    # Find problematic patterns in code
npm run check                   # Check source code for type errors
npm run test                    # Run unit tests once
npm run test:watch              # Run unit tests in watch mode

Debugging

# Option 1:
npm run build && node build/server.js --debug --nolazy

# Option 2:
npm run start -- --debug --nolazy

After launching the app in a debug mode attach your debugger to the process listening on 127.0.0.1:5858.

Contributing

Anyone and everyone is welcome to contribute. Start by checking out the list of open issues marked help wanted. However, if you decide to get involved, please take a moment to review the guidelines:

Related Projects

Support

License

Copyright © 2016-present Kriasoft, LLC. This source code is licensed under the MIT license found in the LICENSE.txt file. The documentation to the project is licensed under the CC BY-SA 4.0 license.


Made with ♥ by Konstantin Tarkus (@koistya) and contributors

graphql-starter-kit's People

Contributors

koistya avatar aarmand avatar

Watchers

Rico Moorman avatar James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.