2. Michael Hackstein
@mchacki
• Member of ArangoDB
Core Team
• web front-end
• graph features
• Organizer of cologne.js
• Master’s Degree
(spec. Databases and
Information Systems)
9. What is ?
• a multi-model database (document store & graph database)
• is open source and free (Apache 2 license)
• offers convenient queries (via HTTP/REST and AQL)
• offers high performance and is memory efficient
• uses JavaScript throughout (V8 built into server)
• doubles as a web and application server (Foxx)
• offers many drivers for a wide range of languages
• is easy to use with web frontend and good documentation
• enjoys good professional as well as community support
• and recently added sharding in Version 2.0.
11. • … a feature of ArangoDB since 1.4
• … an easy way to define REST APIs on top of
ArangoDB
• … a toolset for developing your single page
web application
• … not requiring any special code on the client
side – use it with Angular, Backbone,
Ember,…
Foxx is…
12. Why another solution?
• ArangoDB Foxx is streamlined for API
creation – not a Jack of all trades
• There‘s no communication overhead
between (serverside) application and
database
• It is designed for front end developers: Use
JavaScript, you already know that
22. • In your Foxx.Controller you describe your
routes
• But your application can consist of multiple
Foxx.Controllers
• … and you also want to deliver assets and
files
Manifest.json
23. {
"name": "my_website",
"version": "1.2.1",
"description": "My Website with a blog and a shop",
"thumbnail": "images/website-logo.png",
!
"controllers": {
"/blog": "apps/blog.js",
"/shop": "apps/shop.js"
},
!
"assets": {
"application.js": {
"files": [
"vendor/jquery.js",
"assets/javascripts/*"
]
}
}
}
24. {
"name": "my_website",
"version": "1.2.1",
"description": "My Website with a blog and a shop",
"thumbnail": "images/website-logo.png",
!
"controllers": {
"/blog": "apps/blog.js",
"/shop": "apps/shop.js"
},
!
"assets": {
"application.js": {
"files": [
"vendor/jquery.js",
"assets/javascripts/*"
]
}
}
}
25. {
"name": "my_website",
"version": "1.2.1",
"description": "My Website with a blog and a shop",
"thumbnail": "images/website-logo.png",
!
"controllers": {
"/blog": "apps/blog.js",
"/shop": "apps/shop.js"
},
!
"assets": {
"application.js": {
"files": [
"vendor/jquery.js",
"assets/javascripts/*"
]
}
}
}
26. More
• Define a setup and teardown function to
create and delete collections
• Define lib to set a base path for your require
statements
• Define files to deliver binary data unaltered
36. Why this separation?
• It doesn‘t violate the SRP like ActiveRecord
• In a lot of cases you can use the standard
Repository or Model and don‘t need your own
• It‘s great for testing
• You can mock the collection and the model
prototype to test your Repository
• You don‘t need to mock anything to test
your model
37. Foxx.Model
• The constructor takes a hash of attributes
• Access the attributes with get, set and has
• The forDB will be used to write the data into
the database
• Use forClient to prepare the data for delivery
38. Foxx.Repository
• The constructor takes an arangodb-
collection and the prototype of the model
• save for example expects an instance of the
model
• firstExample finds a suitable dataset and
returns it as an instance of the model
• Other methods: remove, replace, update…
39. You need more?
• Use Foxx.Repository.extend and
Foxx.Model.extend to inherit from the
prototype
• Add your own methods
• Your extensions live in separate files
43. Contact
• I am mchacki everywhere:
• mchacki@arangodb.org
• @mchacki on Twitter
• mchacki on Github
44. Thanks
• First Slide version by Lucas Dohmen
• Database icon designed by Romeo Barreto
from The Noun Project
• Logos from Node.js, Ruby on Rails, Django,
AngularJS, Backbone, Ember and Symfony
from the respective projects
• All other icons are from Font Awesome