Foxx Microservices

    ArangoDB allows application developers to write their data access and domain logicas microservices running directly within the database with native access toin-memory data. The Foxx microservice framework makes it easy to extendArangoDB’s own REST API with custom HTTP endpoints using modern JavaScript runningon the same V8 engine you know from Node.js and the Google Chrome web browser.

    Unlike traditional approaches to storing logic in the database (like storedprocedures), these microservices can be written as regular structured JavaScriptapplications that can be easily distributed and version controlled. Depending onyour project’s needs Foxx can be used to build anything from optimized RESTendpoints performing complex data access to entire standalone applicationsrunning directly inside the database.

    If you’re coming from another JavaScript environment like Node.js this issimilar to running multiple Node.js processes behind a load balancer:you should not rely on server-side state (other than the database itself)between different requests as there is no way of making sure consecutiverequests will be handled in the same context.

    Because the JavaScript code is running inside the database another differenceis that all Foxx and ArangoDB APIs are purely synchronous and should beconsidered blocking. This is especially important for transactions,which in ArangoDB can execute arbitrary code but may have to lockentire collections (effectively preventing any data to be written)until the code has completed.

    Compatibility caveats

    While ArangoDB provides a lot of compatibility code to support code writtenfor Node.js, some Node.js built-in modules can not be provided by ArangoDB.For a closer look at the Node.js modules ArangoDB does ordoes not provide check outthe .

    When using bundled node modules keep in mindthat these restrictions not only apply to the modules themselves but alsothe node dependencies of those modules. As a rule of thumb: