Skip to content

πŸ—„οΈ GraphQL Back-end Server with Relay, Koa, MongoDB and Mongoose

Notifications You must be signed in to change notification settings

biantris/koa-server

Folders and files

NameName
Last commit message
Last commit date
Mar 20, 2023
Mar 20, 2023
Mar 20, 2023
Mar 20, 2023
Mar 21, 2023
Mar 21, 2023
Mar 20, 2023
Aug 11, 2022
Mar 20, 2023
Mar 20, 2023
Jun 3, 2022
Mar 20, 2023
Mar 20, 2023
Mar 20, 2023
Mar 20, 2023
Mar 21, 2023
Jan 13, 2025
Mar 20, 2023
Mar 21, 2023
Mar 20, 2023
Mar 20, 2023
Jan 13, 2025

Repository files navigation

image

koa-server

GraphQL Back-end Server with Relay, Koa, MongoDB and Mongoose

Tests Passing Coverage Status follow on Twitter

🚧 WIP 🚧

Note See Front-end project graphql-relay-web

Stack

  • Koa
  • MongoDB
  • Mongoose
  • GraphQL
  • Relay
  • Jest
  • SuperTest
  • Code Coverage(Coverall) see
  • Linter (Eslint)
  • Prettier

Project architecture

.
β”œβ”€β”€ graphql/
β”‚   └── schema.graphql
β”œβ”€β”€ script
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ __tests__
β”‚   β”œβ”€β”€ database
β”‚   β”œβ”€β”€ graphql
β”‚   β”œβ”€β”€ modules/
β”‚   β”‚   β”œβ”€β”€ event/
β”‚   β”‚   β”‚   β”œβ”€β”€ __tests__
β”‚   β”‚   β”‚   β”œβ”€β”€ fixure
β”‚   β”‚   β”‚   β”œβ”€β”€ mutations/
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ __tests__
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ EventCreateMutation.ts
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ EventDeleteMutation.ts
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ EventUpdateMutation.ts
β”‚   β”‚   β”‚   β”‚   └── index.ts
β”‚   β”‚   β”‚   β”œβ”€β”€ EventFilterInputType.ts
β”‚   β”‚   β”‚   β”œβ”€β”€ EventLoader.ts
β”‚   β”‚   β”‚   β”œβ”€β”€ EventModel.ts
β”‚   β”‚   β”‚   └── EventType.ts
β”‚   β”‚   └── node/
β”‚   β”‚       └── typeRegister.ts
β”‚   β”œβ”€β”€ schema/
β”‚   β”‚   β”œβ”€β”€ MutationType.ts
β”‚   β”‚   β”œβ”€β”€ QueryType.ts
β”‚   β”‚   └── schema.ts
β”‚   └── shared
└── test

Getting Started

  • clone this repo
# install dependencies
> yarn
# or
> yarn install

# copy .env file
> cp .env.example .env

# start project
> yarn start

# see on GraphiQL graphql interface on localhost link
http://localhost:9000/graphql

# or see graphql Playground
http://localhost:9000/playground

Generating the schema

> yarn schema

Create events manually

> yarn seed

to-do

demo

Mutations

  • Event Create Mutation
mutation {
  EventCreate(
    input: {
      eventId: 564654
      name: "nice event"
      start: "2022-07-01T00:00:00.000Z"
      end: "2022-07-01T23:59:59.000Z"
      allDay: false
    }
  ) {
    event {
      id
      name
      start
      end
      allDay
    }
    error
    success
  }
}
  • Event delete Mutation
mutation {
  EventDelete(input: { eventId: "629521641ff2c2c8f5f2e449" }) {
    eventId
    error
    success
  }
}
  • Event Update Mutation
mutation {
  EventUpdate(
    input: {
      eventId: "62952906f5c651ced019adf3"
      name: "nice event /o/"
      start: "2022-07-01T00:00:00.000Z"
      end: "2022-07-01T23:59:59.000Z"
      allDay: false
    }
  ) {
    event {
      id
      name
      start
      end
      allDay
    }
    error
    success
  }
}

Queries

  • Event queries
query {
  events {
    edges {
      node {
        name
        start
        end
        allDay
      }
    }
  }
}

contributions

Feel free to contribute to this project, if you find any bugs or improvements, open an issue and send a PR about it \o/