Getting Started with Hello World Data Sync

In this example, you add the Voyager Server library to your Express node.js project, create an index-1.js file, run the server, and query GraphQL.

  • Voyager Server is a set of Node.js libraries that can be used to build a Data Sync server.

  • Voyager Server is the starting point for developing a Data Sync application.

  • You have Node.js and npm installed.

  • You have created a node.js project.

  1. Add libraries to your Node.js application:

    $ npm install graphql (1)
    $ npm install express (2)
    $ npm install @aerogear/voyager-server (3)
    1 See
    2 See
    3 The Voyager Server library that enables data sync
  2. Create an index-1.js file with the following content:

    const express = require('express')
    //Include our server libraries
    const { VoyagerServer, gql } = require('@aerogear/voyager-server')
    //Provide your graphql schema
    const typeDefs = gql`
      type Query {
        hello: String
    //Create the resolvers for your schema
    const resolvers = {
      Query: {
        hello: (obj, args, context, info) => {
          return `Hello world`
    //Initialize the library with your Graphql information
    const apolloServer = VoyagerServer({
    //Connect the server to express
    const app = express()
    apolloServer.applyMiddleware({ app })
    app.listen(4000, () =>
      console.log(`🚀 Server ready at http://localhost:4000/graphql`)
  3. Run the server:

    $ node index-1.js
    🚀 Server ready at http://localhost:4000/graphql
  4. Browse http://localhost:4000/graphql and interact with the playground. For example:

  5. Check the output. For the example above, the output should be:

      "data": {
        "hello": "Hello world"

To get started with the Data Sync framework, see the sample application. In this app, you can explore a more complex schema.

Before proceeding, make sure you have an understanding of the following GraphQL concepts:

  • Schema design

  • Resolvers

  • Subscriptions