ArangoDB uses a Node.js compatible module system. You can use the function require in order to load a module or library. It returns the exported variables and functions of the module.
The global variables
__dirname are available throughout ArangoDB and Foxx.
Node compatibility modules
ArangoDB supports a number of modules for compatibility with Node.js, including:
assert implements basic assertion and testing functions.
events implements an event emitter.
module provides direct access to the module system.
path implements functions dealing with filenames and paths.
querystring provides utilities for dealing with query strings.
stream provides a streaming interface.
string_decoder implements logic for decoding buffers into strings.
url provides utilities for URL resolution and parsing.
util provides general utility functions like
Additionally ArangoDB provides partial implementations for the following modules:
cwd; stubs for
timers: stubs for
The following Node.js modules are not available at all:
crypto (but see
http (but see
ArangoDB Specific Modules
There are a large number of ArangoDB-specific modules using the
@arangodb namespace, mostly for internal use by ArangoDB itself. The following however are noteworthy:
@arangodb provides direct access to the database and its collections.
@arangodb/crypto provides various cryptography functions including hashing algorithms.
@arangodb/request provides the functionality for making synchronous HTTP/HTTPS requests.
@arangodb/foxx is the namespace providing the various building blocks of the Foxx microservice framework.
Bundled NPM Modules
The following NPM modules are preinstalled:
dedent is a simple utility function for formatting multi-line strings.
error-stack-parser parses stacktraces into a more useful format.
graphql-sync is an ArangoDB-compatible GraphQL server/schema implementation.
highlight.js is an HTML syntax highlighter.
i (inflect) is a utility library for inflecting (e.g. pluralizing) words.
iconv-lite is a utility library for converting between character encodings
joi is a validation library that is supported throughout the Foxx framework.
minimatch is a glob matcher for matching wildcards in file paths.
qs provides utilities for dealing with query strings using a different format than the querystring module.
semver is a utility library for handling semver version numbers.
sinon is a mocking library for writing test stubs, mocks and spies.
timezone is a library for converting date time values between formats and timezones.