Just wanted to share a couple of proof of concepts I recently created using TeaVM.
1.
https://webliteca.github.io/teavm-react/ What: A TeaVM wrapper for React.
Why? React is the de-factor standard for Web UIs right now - and I wanted to make a couple of web apps in Java.
2.
https://webliteca.github.io/teavm-lambda/What: A server-side (serverless) framework framework that can be deployed to either a JVM back-end (as war or uberjar) or a nodejs backend. Provides a cross-platform API layer that is agnostic of back-end.
Why? I wanted to make some services I could deploy as Lambdas or CloudRun services so that they can scale to zero, and existing Java frameworks don't make that easy, because cold starts take too long.
E.g. Deploying my sample Quarkus REST apps to CloudRun had cold starts of 30 seconds when trying to deploy as jar. Building for native using GraalVM (which is the recommended approach for Quarkus) got cold starts down to 2 seconds, but the builds take 10 minutes, and it is a bit of a painful experience dealing with all of the things that don't work with GraalVM.
Deploying nodeJS apps to CloudRun have almost instance cold starts though, so I figured, why not see what we can do with TeaVM to create an app in Java that deploys to CloudRun.
And to my surprise, it actually works really well.
The framework currently includes APIs for all of the "cloud" things i need in my own service apps, such as DB access, objects stores, queues, logging, dependency injection, etc..
I'm currently dog-fooding both of these in a couple of apps I'm developing right now. And those documentation sites are both written in teavm-react.
The general app architecture I'm using for these "full-stack" TeaVM apps is:
1. Terraform to provision all cloud resources via github workflows.
2. Firebase hosting for front-end app (teavm react)
3. CloudRun services for back-end apps, so they can scale to zero.
4. Other resources as apps need (e.g. S3/R2, SQS/PubSub, etc..)
Thanks for this great tool Alexey. It really is a lifeline for Java to easily step into the JS/WASM/NodeJS eco-system.
-- Steve Hannah
Web Lite Solutions Corp.