JavaScript RAD platform

Web and desktop apps

Module system

Role based security

Parallel JavaScript

Universal UI forms and widgets

Data on your fingertips

Develop all applications using JavaScript!

Sometimes a browser is just not enough for your application as a client.
Maybe you do not need an application server at all.
In this case use the desktop Java SE client to run the same UI forms as a HTML5 browser.

Modules system

Modules of Platypus.js areJavaScript modules desinged as AMD modules or as Global modules

  • AMD modules loader both on server and on client
  • Multiple JavaScript engines in single Java process with no inter-process communication overhead
  • Automatic dependencies resolving of global modules
  • Role based security system like in Java EE
  • Modules can have file like names or short names depending on wich version of define function used
Modules can run on a client as well as on a server.
The code snippet below shows a simple module example:
 * To assign a short name to this module, use three arguments define.
define('documents', ['logger', 'orm'], function(Logger, Orm, ModuleName){
    function Documents() {
        var model = Orm.loadModel(ModuleName);
        this.logDocuments = function(categoryId) {
            model.documents.params.catId = categoryId;
                model.documents.forEach(function(doc) {
          "Document name: " +;
    return Documents;


Security support comes out-of-the-box in Platypus.js. Every resource like module or Sql query can be protected on the base of a currently logged-in user's roles. Platypus.js security subsystem is based on the Java EE security model and provides a very configurable mechanism for restricting access.
Various user information storages are supported. Use database user information storage or any external provider like Microsoft Active Directory or an OpenLDAP server.

Security annotations in JavaScript modules

     * In general, Platypus module starts with the JsDoc annotation
     * @author athorName
     * To allow usage from the client:
     * @public 
     * To set user roles allowed to use this module:
     * @rolesAllowed admin, developer
     * To assign a short name to this module, use three arguments define
    define('GreatnessChecker', ['security'], function(Security){
        function GreatnessChecker() {
            var self = this;

             * You can define allowed roles for each function
             * @rolesAllowed admin
            self.amIGreat = function (onSuccess, onFailure) {
      'Looking if the user is great...');
              'Ah, the user is Great!');
                        onSuccess('Ah, you are Great!');
                    } else {
              'No, the user is not Great.');
                        onSuccess('No, you are not Great.');
                }, onFailure);
        return GreatnessChecker;

Security annotations in Sql queries

     * @author authorName
     * @name myQuery
     * To allow usage from the client side:
     * @public
     * @rolesAllowed maintainer, admin
     * @rolesAllowedRead guestUser
     * @rolesAllowedWrite ghostUser
     Select * From someTable t1
     Where t1.someColumn = :myParam

Parallel JavaScript and IO models

Platypus.js server JavaScript works in multi-threaded environment with a few threads (in general cores + 1 threads if async IO is used).
Platypus.js gives you a chance to choose the IO model for the specific situation and allowes to use both AsyncIO or Blocking IO models, providing performance that is good enough for the most types of applications (don't forget all UI logic runs on the client side).

Here is an example of parallel executed modules:

     * Here is session statelessl module, serving user's request.
     * The following annotation is needed to create stateless module. 
     * @stateless
    define(function (){
        function Worker(){
            var self = this;

            this.calc = function (aAngle) {
              return Math.tan(aAngle);// One of parallel operations here
        return Worker;

     * Here is session statefull module, serving user's request and
     * performing calculations in 'Worker' module.
     * Session statefull modules are created by default without any annotations.
    define(['rpc'], function(Lpc){
        function Processor(){
            var self = this;
            this.process = function(aAngles, aOnSuccess){
                var results = [];
                var w = new Lpc.Proxy('Worker');
                var calced = 0;
                    w.calc(aAngle, function(aTan){// Call to LPC stub. Actual calc
                                                  // function will be called by 
                                                  // Platypus.js runtime probably in
                                                  // several concurrent threads.
                        if(results.length === aAngles.length){
        return Processor;

Here are examples of asynchronous data queries

With loading data and replacing the data of the entity:

    // The first param used as the succesfull callback function and the second as the failure callback
    model.myDataEntity.params.keyField = 'keyValue';
    model.myDataEntity.requery(function () {
        // Data in 'model.myDataEntity' have been replaced by just retrieved data.
        Logger.warning("Couldn't load data!");

    doSomeMoreWork(); // It will be executed immidiatly after calling the above requery function without waiting for it's result
    // There are a lot of functions that could work asynchronously. To learn more have a look at the documentation.

Query execution without replacing the data of entity:

    // The first param used as parameters container.
    model.myDataEntity.query({keyField: 'keyValue'}, function (loadedData) {
        // Data in 'model.myDataEntity' remain unchanged.
        // 'loadedData' contain new just retrieved data.
        Logger.warning("Couldn't load data!");

    doSomeMoreWork(); // It will be executed immidiatly after calling the above requery function without waiting for it's result
    // There are a lot of functions that could work asynchronously. To learn more have a look at the documentation.

Universal UI forms

A form is a kind of a module with UI layout definition in a XML file.
Single-page web application or Java SE desktop application share the same forms. A library of widgets includes a bunch of simple widgets, panels and menus as well as smart model widgets which are bound to the model's data. With visual form editor you can create your application user interface without any coding and knowing about HTML and CSS.

Data is on your fingertips

Use databases native language Sql. You can say exactly what you want from a database: how query data, insert or update. In our platform we go further: Platypus.js can formulate data change commands on the base of SELECT data queries. You can write database specific queries if you want. ORM subsystem transforms relational data into JavaScript objects.

Data model provides access to various relational databases.

Also, there is a MongoDB client for Platypus.js

For example you have an Sql query:

     * @author greatMan
     * @name testQuery
     * This annotation tells Platypus.js, that this query's data can be requested by client through application server.
     * @public
     * The following annotation tells Platypus.js what table could be modified,
     * while applying a changelog to the database:
     * @writable employees
     Select t1.employee_id, t1.employee_name, t2.city_name
     From employees t1
     Inner join cities t2 On t1.city_id = t2.city_id

This query is connected with module data model. And it became a new JavaScript object. You are free to change it's properties. These changes will be recorded as changelog wich later may be saved to a database:

     * @author OneGreatMan
     * @public
    define(['logger', 'orm'], function(Logger, Orm, ModuleName){ // ModuleName is extra parameter, added by Platypus.js runtime
        function EmployeeUtils() {
            var self = this, model = Orm.loadModel(ModuleName); // This line was automaticly generated on module creation

            this.processEmployees = function () {
                // Model's data sets are regular javascript arrays
                    aItem.employeeName = 'Some funny name :)';
                // It will save all data changes at exactly same sequence that they were made
          'Data have been saved successfully');
        return EmployeeUtils;

Complete set of Netbeans IDE plugins for platypus projects

It's all that you need to whole developing process.

Database structure

Sql queries

Source code

Data model

User interface