What is Ratpack?

Ratpack is a simple, capable, toolkit for creating high performance web applications.

Ratpack is built on Java and the Netty event-driven networking engine. The API is optimized for Groovy and Java 8, though Java 7 can also be used.

Optional Google Guice integration provides a foundation for scaling your application in size in a managed way.

Optional Gradle build time support makes building and testing applications a breeze.

Getting Started

Here's a simple executable Groovy script that is a complete Ratpack application …

@Grab("io.ratpack:ratpack-groovy:0.9.3")
import static ratpack.groovy.Groovy.*

ratpack {
  handlers {
    get {
      render "Hello world!"
    }
  }
}

Here's the equivalent in Java 8 …

import ratpack.launch.*;
import ratpack.server.*;
import ratpack.handling.*;
import ratpack.util.Action;
import static ratpack.handling.Handlers.*;
import java.io.File;

public class App {
  public static void main(String[] args) throws Exception {
    File baseDir = new File("/path/to/app/dir");
    RatpackServerBuilder.build(
      LaunchConfigBuilder.baseDir(baseDir).build((launchConfig) -> {
        return chain(launchConfig, (Action) (chain) -> {
          chain.get((context) -> { context.render("Hello World"); });
        });
      })
    ).start();
  }
}

That's just the tip of the iceberg.

Check out the Ratpack Manual for more possibilities, or the example apps on GitHub.