COMMUNITY

Haxe seems great but not for webdevelopment

When l read what haxe can do l get really amazed and l cant believe that l have totally missed out on this language. When l look for libs for professional web development l mostly find tools or projects that seems abandoned.
Today l work with

Laravel php
vuejs
react
nginx

Would you say haxe could replace these technologies with mature active haxe libs? What libs would that be? I only find ufront and it seems to be dead. Thank you

1 Like

Hi @tubbs,

welcome ! As you seen, Haxe is a bit niche, and web has been for a long time a niche inside Haxe, which is most used for gaming. Indeed ufront seems a bit dead. While much appreciated in it’s time, it didn’t enought traction and Jason, the main maintainer, seem to have moved forward.

Nowadays, and for some time, tink_web (github, doc, discord, gitter) seems the goto for web backend stuff. Coconut (github, discord, gitter, TodoMVC example) is it’s front end buddy, which can be used autonomously or as an abstraction over React. This ecosystem is used in web projects and game companies, and is building on a dedicated community, so it seems mature and to have a secured future.

As a server, you can use Apache or Nginx, Nodejs or JVM servers… here, Haxes targets come handy. On server side, Weblink is a “pure haxe” server based on libuv and hashlink, Haxe’s most recent “tailored” VM, replacing neko, and while still in dev, seems to have nice performance.

Obviously, Haxe has a smaller mind-share than mainstram languages, but if you have the liberty to choose you tools and like to tinker and learn, it is a nice asset. :slight_smile:

1 Like

Thank you very much for your elaborate answer)!

Also, Haxe can leverage existing solution. Nothing prevents you from using Haxe with Laravel (I don’t use the PHP target myself, but it shouldn’t be an issue), with React (have been doing so in production for 5 years), etc.

You don’t actually need ‘modern’ web frameworks as much in haxe, because haxe compiles to a single file, so no webpack is needed, and you don’t really need vdom as you can retain references to div locations or create them on the fly and structure use with your own choice of design pattern and classes. You can use classes more like traditional mainstream language like you might in c# or java.

It can be interesting using haxe with traditional web tech for say a quick android touchscreen using electron.

And using haxe nodejs can be easy for instance I used it for creating a private local application to help manage shopify.

Have some nodejs file helpers that I have used with electron.

And some helpers for messing with html

but tink and soon haxe will have async ‘sys’ stuff that can be used with nodejs.

It’s quite easy to use Flexbox and even just use some static inline module functions.

package someFlexStyles;
import js.html.CSSStyleDeclaration;
function style1( style: CSSStyleDeclaration ){
        style.display = 'flex';
        style.flexDirection = 'row';
        style.backgroundColor = 'transparent';
        style.position = 'absolute';
        style.width = '100vw';
        style.height = '100vh';
        style.margin = '0';
        style.padding = '0';
        style.alignItems = 'center';
    }

And bulid up complex flexbox structures even with clipped videos. Really with haxe it’s possible to build from scratch and make robust product rather than being tied to latest fad framework.

WebGL is very viable to create from scratch, you don’t have to use mainstream but can role your own.

For instance I made this port of smiley WebGL demo
https://nanjizal.github.io/webgl-example/indexHaxe.html

and improved the structures with haxe typedness.

And my hyperKitGL library is quite nice for fiddling about with your own WebGL structures especially 2D.

Obviously you can use more extensive libraries with WebGL like Kha or ThreeJS or any haxe game toolkit.

The reality is that if your trying to copy and paste code and hook into premade npm modules Haxe is likely to be much more hardwork for a traditional js dev, but if your prepared to get your hands dirty it’s quite feasible to do it all from scratch something that is less feasible in javascript.

I am fully aware some of my libraries above may not be as web professional as some libraries you may find, but the point was more you can just pick up haxe and make it do what you need and really the boundary between haxe js, haxe c++, haxe nodejs, etc… can easily start to blur, yet you can hook up with traditional html dom just as easily, there is no reason you can’t make the next killer website or tool/library for the web, and you don’t have to use react but you can.

Thanks, did l get you right? Have you been working with haxe’s react libs professionally? Could you pls tell me your workflow.

my goals are to get away from from npm, php and javascript and to be able to work with a typed oop language both front and backend.
The potential in haxe is impressive and l have been looking for something in between gaming and conventional programming for quite a while. With a solid webstack l belive haxe would be unbeatable.

Oh and markdown can be great for just putting some markdown online and easy to string some pages together.

hey cheers! Thanks!

1 Like

Not used React in Haxe, but it is used and works well, but not really something I would use out of interest.

I used Haxe electron once for a 4K touchscreen display prototype with mulitple masked videos with flexbox, for large fashion shop in central London. So I guess that was professionally? Initially I tried traditional React and js but it was so much hassle to animate the video masks and interaction, to me React is too ridgid, but my background is more animation and as3.

So I just switched to using my prefered Haxe and got it working fully in half the time, and I am sure it performed better and smoother, really I just feel better with code than fighting css and html files so I am not really a good person to talk about ‘modern web frameworks’, as they make me start to yawn. In many instances I am not convinced that virtual doms are needed or even that sensible, I think much of modern web approach is to compensate for js not being a good enough language and the browsers tech being so fractured.

I actually worked with flash as3 professionally for 8 years but when flash died l started with more conventional web-coding. Ever since l have been talking about how good the flash platform was and how much css, npm and all the hazzle of web-programing suck. It seems there is a way out of that with haxe and l’m just trying to ensure that l’m not ending up in a dead end when l launch my first haxe project. Thanks for all your input.

The main problem with haxe is not it’s ability, it can do anything fairly well, but more that most roles are around game dev so fairly high level compared to say as3 general roles, and require relocation to different part of the world, but if you have clients that trust you already Haxe is a very useful tool.

Also Haxe does not go away it’s been around over a decade, it works well so for anyone that is not bothered about following the crowd it’s a good tool.

I am using Haxe professionally right now. I built an IoT platform with Haxe entirely. The platform contains:

  • a frontend webapp which uses MVCoconut over React.js. It features interactive 2D map views, interactive 3D model views and real time update of the IoT device statuses
  • a web backend RESTful API server written with tink_web
  • a database layer written with tink_sql
  • a message hub which handles hundreds of messages per second during peak hours. It comprises of a few libs such as why-mqtt and why-pubsub
  • a gateway for IoT devices to connect to, it supports both UDP and TCP with a custom proprietary binary protocol which is small and compact thus suitable for embedded devices

All of above are written in Haxe and target javascript. Besides Haxe libraries, I am also utilizing a lot of javascript libraries that can be found on npm.

P.S. we are even hiring! (but Hong Kong and Taiwan only)

7 Likes

cool, thanks!!!

Hi Tubbs!

Since some months, I’m using Haxe to contribute npm components to a larger js/ts React/Next.js project. Using benmerck’s genes library (GitHub - benmerckx/genes: Generates split ES6 modules and Typescript definitions from Haxe modules.) has been a great help to figure out a working workflow, as it renders the Haxe solution as importable es6 modules instead of a single file.

I hope to be able to document some of my learnings soon. Some months ago, I created this video about setting up a React Native project using Haxe: https://www.youtube.com/watch?v=e8gqN0PDJos
Maybe you can get some ideas about possible workflows there.

Don’t hesitate to ask here if there is something specific that needs to be figured out. I’m not at all sure that I can give you good answers, but I would be happy to contribute to the best of my ability.

1 Like

Tack Jonas! Ska kolla in din video)

You’re välkommen! :slight_smile:

Hej,

I’ve just read quickly the title so sorry for my approximative answer, but I use Haxe for web developpement since 2009 and I also have built some profesionnal applications based on web layouts and I’ll never change for anything else since this time.

In the past I’ve also written some tutorials to build a complete and sophisticated website from scratch using almost tools delivred with Haxe, but I’ve changed my website since and I can’t find these tutos now and I think they will mostly be outdated.

Of course, I’m not really an example because I use as less external libs as possible, and I also have some custom tools but I really take pleasure to work with Haxe for web developpment.

Maybe when I’ll have time I’ll try to rewrite some posts about web developpment using Haxe.

Sorry for this comment that don’t give any concret help, I just wanted to say that IMHO Haxe is as powerful for web developpment as it is for games.

I was in a similar boat and am perhaps what you call an early adopter of Haxe. Since that time I’ve dabbled in using the PHP target with Ufront, tink_web and even Joomla. However I’ve gained the most satisfaction and progress from making OpenFL do what I want on browser side. My mind hasn’t really left the AS3 world yet. :slight_smile: UI frameworks such as FeathersUI and HaxeUI are very good nowadays.

I’m thankful for all the input I can get here so, thanks! I already started to fiddle around with haxe and so far I really like it.