What is it for?


For building configurable, large scaling modular applications, games, stateful websites and servers, targeting JavaScript, Flash, PHP, Neko platforms.
hexMachina is OpenSource, free to use and collaborate.

Want to learn more?


Join the Community
hexMachina Forums
Check Github repositories
Github hexMachina
Get started
hexMachina Documentation
Follow our blog
hexMachina Blog

Features of the framework


hexMachina relies on a smart mix beetween declarative and imperative programming. The main concept is to split your application codebase in two distinct parts. The first one is made from resusable micro-applications called components developed with haxe language. The second one is driven by DSL for describing your components assembling and your application behaviors.

hexMVC

MVC implementation for writing individual modules with the classical Model-View-Controller structural pattern.

class MyModule extends Module {
    public function new( view:IMyView ) {
        this._addStatelessConfigClasses([MyModuleCommandConfig]);
        this.buildViewHelper(MyViewHelper, view);
    }
}

private class MyModuleCommandConfig extends StatelessCommandConfig {
    override public function configure() {
        this.map(MyModuleMessage.MODULE_READY, InitModuleMacro).once();
        this.map(MyModuleMessage.GET_NEWS, GetNewsCommand);
    }
}
hexIoC

Inversion of Control system to make multi-modular applications. You can have an extremely powerful DSL layer (Domain Specific Language), where you can connect together any modules, components and describe any dependency, behavior between them.

<module id="myModule" type="myproject.module.mymodule.MyModule">
    <listen ref="myService">
        <event static-ref="myproject.myservice.MyServiceMessage.FIRE" method="setFire"/>
    </listen>
</module>

<service id="myService" type="myproject.service.myservice.MyService">
    <property name="myprop" value="15" />
</service>
hexInject

Powerful and easy-to-use Dependency Injection system based on @annotations. It supports property, method and constructor injections predefined in injector mappings.

class MyClass {
    @Inject
    public var myProperty:IConcreteDependecy;

    @Inject( "myName1" )
    public var property1 : String;

    @Inject
    public function myFunction( dep : Clazz, dep2 : ISomeInterface ) {
        // function body
    }
}
hexUnit

Extendable UnitTest runner with a basic set of assertions. It works well together with any mocking and assertion system. JUnit and FlexUnit like syntax.

class MyTest {
    var service:IMyService;

    @Before
    public function setUp() {
        this.service = new MyServiceMock();
    }

    @Test("Test sum method")
    public function testAdd() {
        Assert.equals( 8, service.add( 3, 5 ), "Sum of 3+5 should be 8" );
    }
}
hexService

Service layer extension for hexMVC to separate service communications. It has all typical predefined service behaviors like: configuration, success, fail, cancel, timeout, etc.

var service = new MyService ();
service.addHandler (StatelessServiceMessage.COMPLETE, function () {
    trace ("complete");
});
hexAnnotation

Easy-to-use utilities for reading and writing @annotation data.

class MyAnnotations implements IMyAnnotation {
    @MyAnnotation( "yes" )
    var annotated : String;

    @Language( "en" )
    function doTest( i : Int ) : Void {
    }
}
hexState

Powerful easy-to-use StateMachina system based on Martin Dowler’s implementation. It saves you from a lot of issue with invalid states of your application.

var logAsUser = new MessageType( "onLogin" );

var anonymous = new State( "anonymous" );
var user = new State( "user" );

var stateMachine = new StateMachine( anonymous );
var controller = new StateController( injector, stateMachine );

anonymous.addTransition( logAsUser, user);

user.addEnterCommand( DisplayWelcomeCommand );

controller.handleMessage( logAsUser );
hexCore

Common core libraries that everyone needs in everyday developments like: exceptions, dispatcher, logging system, utils, etc.

Logger.getInstance().setLevel( LogLevel.DEBUG );
Logger.getInstance().addListener( new TraceLayout() );
Logger.DEBUG( "test" );

var onTest = new MessageType( "onTest" );
var dispatcher = new ClosureDispatcher();
dispatcher.addHandler( onTest, function () {
    trace( "onTest" );
} );
dispatcher.dispatch( onTest, [] );


Blog

News

hexMachina on Web Unleashed 2016 - Extending JS


Francis Bourre will talk at Toronto on October for Web Unleashed 2016

Read more »
Showcase

TicTacToe


Find below two examples of the popular tic-tac-toe game. I’ve made a single and a multi-module version to showcase you have the free choice to make your aplication as much scaled as you want. If you need, you can go for really module oriented implementation, but if you just want a simple game, without DSL, modules and all the crazy structures, you can just make a simple MVC implementation in one module.

Read more »
News

hexMachina on CodeMotion 2016 - Extending JS


We are happy to announce that hexMachina will participate on one of the biggest coder networks event, the CodeMotion 2016 Warsaw.

Read more »
Showcase

Flickr Gallery - MDVC (Experimental)


This is a simple example using hexMachina to load images from Flickr and display them. It uses a hexMachina’s ICompletable API and is based on a MDVC architecture.

Read more »