Skip to content

maxim5/webby

Repository files navigation


Webby
Webby

Web Server for Humans

Key FeaturesHow To UseLicenseCredits

Key Features

Reduced Java boilerplate

@GET(url = "/hello/{userId}")
@View(template = "hello_user.ftl")
public Map<String, Object> hello(int userId) {
    return Map.of(
        "user", userManager.getUserById(userId)
    );
}

We believe the web-developers should focus on the application and not web/HTTP routine as much as possible. The snippet above is a working example of a web handler that will accept the incoming HTTP request with already extracted URL variables, inject dependencies if necessary, render the template and send the HTTP response.

Low overhead

Webby applies a large variety of optimizations to provide the best latency and GC-friendliness: pre-compute, caching, byte buffer pooling, char buffer reuse and many more.

Library not a framework

public class Pojo {
    @GET(url="/blog_post/{id}/{slug}")
    public @Json List getBlogPost(int postId, String slug) {
        return List.of(...);
    }
}

Webby does not require any code structure, base class inheritance, database, ORM and templating system. A developer has the freedom to apply the library in any way they want.

How To Use

Since Webby is in active development, the best way to add a Gradle dependency is via gitRepository directive.

  • settings.gradle
sourceControl {
    gitRepository('https://github.com/maxim5/webby.git') {
        producesModule("io.spbx.webby:webby")
    }
}
  • build.gradle
implementation ('io.spbx.webby:webby:0.10.0')

To start the web server locally:

public class Main {
    public static void main(String[] args) throws Exception {
        AppSettings settings = AppSettings.fromProperties("app.properties");
        settings.setWebPath("src/main/resources/web/");

        Webby.nettyBootstrap(settings).runLocally(8080);
    }
}

... and Webby will do the rest.

License

Apache 2.0

Credits

Many thanks to Lucas the Spider for the amazing character which inspired our logo.