Giter Site home page Giter Site logo

graphql-server-scaffolding's Introduction

This repository contains a few examples of directory structures for using GraphQL with Apollo Server in Node.js.

minimal

This is the shortest version with only one file to run (src/index.js). The file defines the GraphQL schema along with its resolvers and starts the server. This could be used for small servers (micro-services) and as the benefit of having all the code in one place.

role-oriented

This is a classic directory structure seen in many frameworks. The files are organized by their roles (models, resolvers, type definitions). Its main benefit is to quickly get the picture of all files for specific roles.

domain-oriented

This is also a classic but it's less common. Instead of organizing the files in roles, they are organized by business domain. For example, the business domain of books contains all its data, models, resolvers and schema. The principal benefit of this structure is its modularity.

It's generally up to you to define your directory structure for your projects. Picking the right one from the start is tricky but you can always change it along the way (although that could also be tricky!).

Feel free to open issues to discuss pros/cons to add here and to suggest other directory structures. Contributions are welcomed.

Twitter @betaflag Medium @betaflag

graphql-server-scaffolding's People

Stargazers

Roman avatar

Watchers

James Cloos 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.