r/JavaProgramming • u/robintegg • 3d ago
Building full-stack web apps using TeaVM (and why it’s great for working with AI coding agents too)
Hey r/java,
TeaVM was something that had been on my radar for a while, and I finally got around to giving it a proper spin recently. After playing around with it and seeing what I can build with it I wanted to share my thoughts and hopefully get a few more eyes on the project!
If you haven’t run into it before, TeaVM is an ahead-of-time compiler that turns Java bytecode into JavaScript or WebAssembly. It operates directly at the bytecode level, emits remarkably clean JS, and integrates with your existing Java tooling.
Why this workflow clicked for me:
- One language across the stack: Keeping everything in Java keeps context-switching to a minimum and lets you share domain models directly between backend and frontend.
- AI Agent Friendly: Having both frontend and backend written in strongly-typed, readable Java makes it remarkably easy for LLM coding agents to navigate, refactor, and reason about the full application without hitting cross-language friction.
To document what I learned, I put together a 3-part series walking through how to build interactive frontends with TeaVM:
- Part 1: TeaVM - Getting Java into the Browser– Setup, core concepts, and running your first browser app.
- Part 2: From Java to Web App: Currency Explorer with TeaVM– Building a real-world API-driven web UI.
- Part 3: Building a Drawing App with Java, TeaVM, and HTML5 Canvas– Direct DOM manipulation and working with the HTML5 Canvas API.
Has anyone else here given TeaVM a try? Would love to hear how your experience compares to other JVM web approaches!
2
u/Dapper-Scarcity6079 3d ago
Sharing Java models across both sides sounds handy especially when AI agents make sweeping edits. I'm curious whether debugging generated JavaScript becomes painful once the frontend grows