Thanks to visit codestin.com
Credit goes to github.com

Skip to content

javelit/javelit

Repository files navigation

Javelit 🚡

Welcome!

What is Javelit ?

Javelit is a Java lightning fast data app development framework, heavily inspired by Streamlit.

Javelit makes it dead simple to create data apps in minutes. Build dashboards, back-offices, generate reports, showcase APIS, etc...
The best part? You can run your Javelit app standalone, or embed it right into your existing Java project.

Javelit demo app

Not convinced? It's ok. Read the Oh No! Another high-level framework and Shouldn't I use Streamlit? sections.

Install

Javelit requires A Java JDK >= 21.

There are 2 main ways to install and run Javelit:

  • as a standalone CLI and app runner
  • embedded in an existing Java project

You'll find a short version below. Read the doc to get more details for each method.

Standalone

  1. Install the CLI (JBang is highly recommended)
    # recommended: install with jbang
    jbang app install javelit@javelit
    
    # vanilla
    curl -L -o javelit.jar https://repo1.maven.org/maven2/io/javelit/javelit/0.76.0/javelit-0.76.0-all.jar
  2. Validate the installation by running the Hello app:
    # jbang
    javelit hello
    
    # vanilla
    java -jar javelit.jar hello
  3. Play with the Hello World!
  4. Want to see a fancier app ?
    javelit run https://raw.githubusercontent.com/javelit/javelit/main/examples/getting_started/App.java

Find more details in the standalone installation doc. Don't forget to install the JBang IDE plugin for completion and highlighting!

Once you're ready to go further, look at the fundamental concepts or jump straight into creating your first app.

Embedded server

  1. Add the dependency to your project
    <dependency>
        <groupId>io.javelit</groupId>
        <artifactId>javelit</artifactId>
        <version>0.76.0</version>
    </dependency>
  2. Launch the server in your project
    void startServer() {
      // prepare a Javelit server
      var server = Server.builder(() -> app(), 8888).build();
     
      // start the server - this is non-blocking, user thread
      server.start();
    }
    
    // the Javelit webapp
    void  app() {
      Jt.text("Hello World").use();
    }

Find more details in the embedded installation doc. Don't forget to look at the IDE hot-reload setup!

Once you're ready to go further, look at the fundamental concepts or jump straight into creating your first app.

Quickstart

Create a new file named App.java in your project directory with the following code:

import io.javelit.core.Jt;

public class App {
    public static void main(String[] args) {
        int x = Jt.slider("Select a value").use().intValue();
        Jt.markdown("## `%s` squared is `%s`".formatted(x, x * x)).use();
    }
}

Run it:

javelit run App.java

Javelit x squared demo

Want more ? look at the fundamental concepts, jump straight into creating your first app.
Not ambitious enough? Create a LangChain4J AI multipage app.

Oh, No! Another high-level framework

Javelit is not another abstraction layer that hides the HTML/CSS/Javascript. That alone is not enough to significantly improve productivity. The real pain is in bindings: handling events, reacting to changes, passing messages, parsing results... you get it.

Javelit promise is to remove all of that.

Here is an example:

double size = Jt.slider("How tall are you ? in cm").max(220).use();
if (size > 200) {
    Jt.text("Damn, that huge!").use();
}

That's it. That's the entire webapp code. Move the slider, and the size variable immediately reflects the latest frontend value. What's the execution order then ? Top-to-bottom. Every time something changes in the app, the logic re-runs from top to bottom, using the most up-to-date values from the frontend.

We hope this sparks your curiosity!

By the way, once you have javelit installed, you can run this example with

javelit run https://raw.githubusercontent.com/javelit/javelit/refs/heads/main/examples/readme/App.java 

Shouldn't I use Streamlit?

Javelit:

  • is Java-native
  • can be embedded directly into your existing Java project.

If neither of those points matters to you... well, farewell. You should use Streamlit.
If you're still there: thanks. There are plenty of smaller differences that make Javelit worth a try: simpler state management, easier custom components, and more.

Contribute

Really? Thanks for you interest in improving Javelit! 🚡
To start a discussion, open an issue or a thread in the forum.
For development, see DEVELOPMENT.md.

Sponsors

If you find Javelit useful, consider sponsoring the project:

Sponsors:

 

License

Javelit is free and open-source, licensed under the Apache 2.0 license.

About

The simplest way to build data apps and webapps in Java. Inspired by Streamlit.

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published

Languages