home shape

Building a self-learning game with ArangoDB, io.js & AngularJS in half a day.

With the ArangoDB Foxx Microservice Framework we’ve introduced an easy way to create a Web API right on top of the NoSQL database.

In early January Max challenged Andreas (AngularJS / NodeJS) that they could build a full-stack application within half a day.

The web application – in short – is a guessing game, in which the computer tries to guess a thing or animal you think of by asking a series of questions, for which you provide the answers. Here’s a demo:

http://guesser.9hoeffer.de:8000

GuesserApp

We use a single collection storing the questions as well as the guesses, which are organized in a binary tree. Each question node has a left and a right child for the two different answers, and each guess is a leaf in the tree. We do not use a graph data model for this since our queries will only be single document lookups. But of course, with ArangoDB you would have the choice to use graph traversals or to JOIN data from different collections.

Andreas and Max have created a 10 step tutorial on Github to illustrate a possible architecture of a web application using AngularJS for the frontend in the browser, io.js as application server and ArangoDB as backend database. All necessary steps are described in detail and you can follow the evolution of the system by looking at each stage without typing code yourself.

GitGuesser We are particularly focusing on ArangoDB and its Foxx Microservice Framework, and only briefly show the io.js and AngularJS parts. In particular, this is not intended to be an AngularJS or io.js tutorial. We even use some shortcuts that one would usually not deploy in production to keep the app simple. Nevertheless, the architecture of the application is in principle suitable as a blueprint for an actual, larger web application.

https://github.com/ArangoDB/guesser

Thanks to Andreas (Freelance NodeJS / AngularJS Developer – https://github.com/m0ppers) and Max (ArangoDB Core – https://github.com/neunhoef) for this tutorial.

If you want to continue with other JavaScript related resources, you should start with ArangoDB NoSQL and JavaScript.

Max Neunhöffer

Max is one of the C/C++ developers working on the ArangoDB core. In particular, he is responsible for the sharding extension and additionally converts the latest ideas from database science into C/C++ code. Furthermore, he enjoys to give public talks about the technical aspects of the ArangoDB development.

Leave a Comment





Get the latest tutorials, blog posts and news: