PurpleJS unites Java and JavaScript development

The framework lets developers write apps in JavaScript that run on the JVM using Java as the runtime

PurpleJS unites Java, JavaScript development
Credit: Pixabay

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.

This story, "PurpleJS unites Java and JavaScript development" was originally published by InfoWorld.

To express your thoughts on Computerworld content, visit Computerworld's Facebook page, LinkedIn page and Twitter stream.
Windows 10 annoyances and solutions
Shop Tech Products at Amazon
Notice to our Readers
We're now using social media to take your comments and feedback. Learn more about this here.