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.


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

class MyModule extends Module {
    public function new( view:IMyView ) {
        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);

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"/>

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

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

class MyClass {
    public var myProperty:IConcreteDependecy;

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

    public function myFunction( dep : Clazz, dep2 : ISomeInterface ) {
        // function body

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;

    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" );

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");

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 {

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 );

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, [] );



0.28.0 - @parser and code.clone()

Let’s highlight some new feature on this new release.

Read more »

flow - @type and @lazy

Let’s highlight two new features in flow arrived with hexMachina 0.27.0.

Read more »

IDependencyOwner, check dependency injection at compiletime

Let’s highlight one new feature arrived with hexMachina 0.22.0.

Read more »

IAnnotationReplace - use constant in annotation

Let’s highlight one new feature on release 0.21.0.

Read more »