We have invited guest blogger, Kevin Frapin, from the University of Orléans to share the story of how Nuxeo found its place among the university’s web applications for its users and how this web application was built. Here is his story!
KISS - Keep It Simple, Stupid
The University pointed out that the users wanted a really simple user interface to interact with the platform with a basic set of actions available - in short, a “Dropbox-like” web interface.
That interface was built and deployed in January 2015 at the University. The main capabilities of this “Dropbox-like” interface are :
- Basic and CAS Authentication
- Document import and download
- Folder creation
- Folder sharing
- Document copy, cut and paste
Here are some screenshots of the web application that was built:
The Application Architecture
After some thought, we decided to use the Nuxeo REST API to build this web application.
However, it appeared that direct Nuxeo API requests from the browser to the Nuxeo Platform were not the best choice for us. That’s because:
- We preferred to control the granularity of the the exposed API
- The web application had to have some interactions with other systems (see the schema below)
So, we decided to create a proxy server exposing a new minimal REST API to the final users, and to make the Nuxeo REST API calls from that proxy server.
This decision led to the creation of a three-part architecture :
- The client side web application
- The server side (proxy) application
- The Nuxeo Platform
We will essentially focus on the server side proxy here and explain how we built it on top of the Nuxeo REST API using a NodeJS server acting like a proxy server.
NodeJS exposing a new REST API
The proxy server could have been developed in multiple technologies, but we decided to use the NodeJS technology to implement it. The main reasons behind choosing this technology were:
- The capability to easily expose a minimal REST API between the user and the proxy
- The capability to easily transform and filter the response of Nuxeo Platform to send it to the user
- The capability to cache data and save some Nuxeo REST API calls
- The capability to put business logic in the proxy server
- The scalability of NodeJS
The Server Application
The main enhancements that we made were :
- The wrapping of new documents methods for easily coping and moving documents
- The addition of the proxy and portal authentications
Those enhancements were contributed as pull-requests and accepted.
Once these enhancements were done, we quickly developed the server side application. This made it possible to realize the following actions on Nuxeo (through the REST API):
- Authenticate a user via basic, proxy and portal methods
- Import one or multiple document(s) from users to the Nuxeo server
- Download document blob from the Nuxeo server to users
- Create new folder(s) on Nuxeo
- Share folders between users
In addition to these Nuxeo interactions, some additional business interactions have been added giving the server side application the capability to:
- Authenticate users on CAS server and Nuxeo
- Communicate with MongoDB databases and LDAP
- Send mails to users
- Put and retrieve data in Redis cache
Having played a lot, during the last months, with the Nuxeo module for NodeJS, we can say that this module should be considered as a serious client for interacting with Nuxeo.
Indeed, this Nuxeo REST API client has a lot of assets and developers interacting with the Nuxeo platform should consider the use of this module in their future developments. The reasons for this are many!
- Simple and comprehensive module
- Fast code writing and deploying on NodeJS
- Fast code executions on NodeJS with asynchronous calls
- Optimizations available on NodeJS (parallel calls, Redis cache, etc.).
To conclude, I can say that there are many other kinds of applications that could use the Nuxeo module, not just web applications. For instance, we can use the Nuxeo module for applications that require a lot of document processing (like batch). The possibilities are endless and you are most welcome to find out for yourself!
 https://www.npmjs.com/package/nuxeo and sources available on Nuxeo GitHub account: https://github.com/nuxeo/nuxeo-js-client/