devxlogo

Build an Intuitive View-Driven Data Stack for Your Modern Apps Using Apollo

Build an Intuitive View-Driven Data Stack for Your Modern Apps Using Apollo

Coming from the likes of Facebook, GraphQL is a modern data service platform that combines both a query language and an execution engine for complex data models. It is driven by the requirements of views and is extremely intuitive for client-side developers to consume and program. The Apollo data stack?builds on the power of GraphQL and provides a set of client and server side components that contain easy-to-use boilerplate templates for setting up a data service for modern UI driven apps. It also provides a set of great developer tools to easily debug what is going on inside your app.

While the stack is still in preview, it gives a good glimpse of its capabilities for developers to get excited and participate in active development. It also integrates well with a bunch of client side JS platforms including React and React Native, Angular 2.0, and Meteor???to name a few. Setting up a server is pretty easy and the queries follow the GraphQL schema specification. To set up the Apollo server, first clone the Apollo starter kit repository using your node console:

Once you have clone the repository you can install the Apollo stack packages using the npm install?command and then start the server using the npm start?command.

By default, the server starts on the 8080 port. If you browse to http://localhost:8080/graphql, you will see the sample GraphQL schema outcome as shown below:

If you go to the data folder under the starter kit, you will see two files: mocks.js and schema.js. The schema.js file contains the default schema you just saw getting executed when you opened the server URL. The mock.js file immediately returns the mocks on querying the schema for testability. The “it works” message that you see in the browser outcome is the mock data being delivered by the mock.js file.

You can define your types in the schema.js file and then use the client to consume the data. A set of connectors are also supported to store the data in actual data repositories like MongoDB, MySQL, and Postgres to name a few. Have fun exploring Apollo!

devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist