Skip to content

Repository files navigation

Java UI for Admin Panels and Realtime Web Apps

Welcome! This is a server-side Java UI toolkit for admin panels, internal tools, and live web applications.

Smallest Interactive Application

import rsp.component.ComponentView;
import rsp.component.definitions.LocalStateComponent;
import rsp.http.WebServer;

import static rsp.dsl.Html.*;

public final class Counter {
    private enum CounterIntent { INCREMENT }

    static void main(String[] args) {
        ComponentView<Integer, CounterIntent> view = intents -> state ->
                html(body(
                        h1("Current count: " + state),
                        button(on("click", _ -> intents.dispatch(CounterIntent.INCREMENT)),
                               text("Increment"))));

        WebServer server = new WebServer(8080)
                .page("/", (_, _) -> new LocalStateComponent<>((_, _) -> 0, view,
                        (state, intent) -> state + 1));
        server.start();
        server.join();
    }
}

The server renders the first page, the browser opens a WebSocket, and subsequent events run Java handlers that produce targeted DOM patches. Application state does not need to be duplicated in a JavaScript frontend.

Try The Repository

Requirements: Java 25 and Maven 3.8.7 or newer.

git clone https://github.com/vadimv/server-components.git
cd server-components
mvn clean install
# Runs the CRUD example
mvn exec:java -pl examples -Dexec.mainClass=rsp.app.posts.CrudApp

Admin UI demo

Open http://localhost:8085 and select Sign in. The default agent is a deterministic local stub and requires no API key.

Documentation

Contributors

Languages