Home Enterprise Applications Java Development NEWS PurpleJS unites Java and JavaScript development

Credits: Computerworld

Credits: Computerworld


Melding Java and JavaScript, PurpleJS is emerging as a framework for running lightweight JavaScript server applications without the complexity of the Node.js asynchronous programming model.

Atop the JVM (Java Virtual Machine), open source PurpleJS can be used when developers want to build multithreaded applications in JavaScript. It allows developers to run the same code in the browser and on the server, and it enables them to employ JavaScript while working with existing Java projects.

“PurpleJS is a simple and capable framework for creating performant web applications without leaving JavaScript,” main developer Sten Roger Sandvik said. “It’s created in Java to give the flexibility and performance Java provides.”

But PurpleJS is not a replacement for Node.js, the popular server-side JavaScript platform, he stressed. “It’s a totally different model since we, for now, do not use async. This fit our needs and was much simpler to program for our initial users.” PurpleJS will support the async programming approach in the future, though.

 Applications are built using the Gradle build system, and the Java SDK. Java serves as the runtime, but coding is done in JavaScript. Developers also can use PurpleJS Boot, a server running the Jetty HTTP server. “It’s very easy to develop in ‘dev’ mode and you will not need to restart the server as long as you stick with JavaScript coding,” Sandvik said.

The APIs in PurpleScript are starting to become more stable, but the framework needs work, Sandvik cautioned. “Application configuration is one thing that’s missing now and should be in place before 1.0. Also, more libraries are needed — SQL, MongoDB, Influx, Freemarker and Velocity to name a few.” He’s also in the process of implementing support for CLIs made with PurpleJS.

Sandvik works at Enonic, which offers its Enonic XP Web Operating System. PurpleJS currently is a separate project from Enonic but it features code donated by Enonic; Sandvik is hopeful PurpleJS one day could be featured as part of Enonic’s platform.